JMIX 2.4 - getPageTitle() Issue

JMIX Version 2.4

I am using this method described in the documentation to modify the title of a window.
This method worked correctly in previous versions.

@Override
public String getPageTitle() {
User user = getEditedEntity();
return entityStates.isNew(user)
? messageBundle.getMessage(“newUserTitle”)
: messageBundle.formatMessage(“editUserTitle”, metadataTools.getInstanceName(user));
}

But throws this error:
Caused by: java.lang.IllegalStateException: Edited entity isn’t initialized yet

Could you tell me any other way to change the window title?

Thanks in advance.

Hi!

The code you provided works correctly in my test case on version 2.4.0.

Could you please provide a test project that reproduces your problem?

Regards,
Dmitriy

Thank you for responding so quickly.
I am attaching the test project that reproduces the problem with a link.
Try editing a product and you will see it.

Thanks in advance

Try the following code snippet:

    @Override
    public String getPageTitle() {
        BCF_PRODUCT bcfProduct = getEditedEntityOrNull();
        String PageTitle = bcfProduct != null
                ? bcfProduct.getCategory()
                : null;

        return Strings.isNullOrEmpty(PageTitle)
                ? super.getPageTitle()
                : PageTitle;
    }

Best regards,
Dmitriy

Thank you very much.