Uploaded image for project: 'Seam International'
  1. Seam International
  2. SEAMINTL-44

BundleTemplateMessage breaks with non-String ResourceBundles

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Rejected
    • Affects Version/s: 3.0.0.Final
    • Fix Version/s: 3.1.0.Beta1
    • Component/s: Messages
    • Labels:
      None
    • Estimated Difficulty:
      Medium

      Description

      BundleTemplateMessages has in build()

              try {
                  text = bundles.get(clientLocale, textKey.getBundle()).getString(textKey.getKey());
              } catch (Exception e) {
                  log.warn("Could not load bundle: " + textKey);
                  text = textDefault;
              }
      

      which will result in a ClassCastException if the resource is non-string (because ResourceBundle.getString implementation casts getObject to String) and is further translated to a "Could not load bundle" warning followed by the BundleKey being outputted.

      Since ResourceBundle.getString is final, there is no way of overloading this behaviour. Using toString on a non-null resource would give some flexibility to this, perhaps.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                kenfinni Ken Finnigan
                Reporter:
                nickarls Nicklas Karlsson
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 6 hours
                  6h
                  Remaining:
                  Remaining Estimate - 6 hours
                  6h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified