Uploaded image for project: '[Read Only] - Hippo Site Toolkit 2'
  1. [Read Only] - Hippo Site Toolkit 2
  2. HSTTWO-4110

Composite resource bundles don't report repeated keys

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Normal
    • Resolution: Won't Fix
    • 4.2.3
    • None
    • hst-api
    • Flagged

    Description

      In the CompositeResourceBundle it is possible to combine resource bundles that contain repeated keys.

      When this happens no message is logged reporting this conflict.

      Instead the code will return the first Value it finds for the requested Key.

       

      org.hippoecm.hst.resourcebundle.CompositeResourceBundle#CompositeResourceBundle

      protected Object handleGetObject(String key) {
          if (bundles == null) {
              return null;
          }
      
          for (ResourceBundle bundle : bundles) {
              if (bundle != null) {
                  try {
                      Object value = bundle.getObject(key);
      
                      if (value != null) {
                          return value;
                      }
                  } catch (MissingResourceException e) {
                      // ignore
                  }
              }
          }
      
          return null;
      }
      

      This is specially important because, to use this feature, developers have to decide what is the strategy to handle this conflict (for example get the last published RB or sort RBs alphabetically, etc..) but still no log message is reported, so the returned value can change in unexpected ways to the editors.

      Attachments

        Activity

          People

            jfloor Jasper Floor
            nmendes Nuno Mendes (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: