Skip to content

Incorrect message resolving when dataverse.lang.directory env variable is set in glassfish and correct message bundle is present in extension #2860

@madryk

Description

@madryk

In extension we have custom metadata block "consent". We have also translation file consent_en.properties directly inside the extension. When we had dataverse.lang.directory set then mechanism with resolving the message in ValidationMessageResolver.resolveValidationMessage did not work correctly. This most likely due to invalid message resolving in BundleUtil.

In consent_en.properties we have the following:

datasetfieldtype.archived_consent.isrequired=Consent is required
datasetfieldtype.publicly_visible_consent.isrequired=Consent is required
datasetfieldtype.rights_consent.isrequired=Consent is required

In the directory pointed by dataverse.lang.directory there is no file named consent_en.properties.

But when the validation message is resolved we got the default from Bundle_en.properties:

isrequired={0} is required.

When env variable dataverse.lang.directory was removed then the application started to resolve to correct message from the extension: Consent is required.

dataverse.lang.directory should not influence message resolving mechanism, when the correct message is not present in the directory pointed by it.

So the message resolving should try with fallbacks:

  • translation datasetfieldtype.archived_consent.isrequired from citation_en.properties in dataverse.lang.directory dir
  • translation datasetfieldtype.archived_consent.isrequired from citation_extension_en.properties from classpath
  • translation datasetfieldtype.archived_consent.isrequired from citation_en.properties from classpath
  • translation isrequired from Bundle_en.properties in dataverse.lang.directory dir
  • translation isrequired from Bundle_extension_en.properties from classpath
  • translation isrequired from Bundle_en.properties from classpath

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions