Uploaded image for project: 'MyFaces Trinidad'
  1. MyFaces Trinidad
  2. TRINIDAD-2473

Improve diagnostic support for resource bundle feature in skinning framework

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.1.0-core
    • None
    • Skinning
    • None

    Description

      We had difficulty diagnosing a skinning issue where the server logs reported some translated keys not being able to be resolved to its value in the resource bundle attached to the skins.

      There are messages like these two in the logs:

      1.

      <17.02.2014 21:22 Uhr MEZ> <Error>
      <org.apache.myfaces.trinidad.context.RenderingContext> <BEA-000000>
      <Ressourcenschlüssel af_document.LABEL_SPLASH_SCREEN konnte nicht aus Skin
      gsr40518e9c_5b59_459a_8d71_85d8a9d30676.desktop abgerufen werden>

      2.

      <17.02.2014 21:23 Uhr MEZ> <Error> <HTTP> <BEA-101020>
      <[ServletContext@797966157[app:de_arbeitsagentur_portal module:apps
      path:/apps spec-version:2.5 version:1.0.0.5.159]] Servlet failed with
      Exception
      java.util.MissingResourceException: Can't find resource for bundle
      at
      org.apache.myfaces.trinidadinternal.skin.SkinImpl.getTranslatedValue(SkinImpl.
      java:183)

      =======

      These are not as useful because they do not give the details of skin or the bundle class that is expected to resolve it, or how in the skin hierarchy this was resolved (or lack of). Relevant code is here:

      =======

      In RenderingContext.getTranslatedString():

      try
      {
      return getSkin().getTranslatedString(getLocaleContext(), key);
      }
      catch (MissingResourceException mre)
      {
      // Instead of halting execution, return "?<key>?",
      // just like JSF and JSTL will do, and log a severe error
      _LOG.severe("CANNOT_GET_RESOURCE_KEY", new String[]

      {key, getSkin().getId()}

      );
      return "?" + key + "?";
      }

      This would not tell if the bundle was read properly in the first place.

      The issue is more evident in this code in SkinImpl.getTranslatedValue():

      if (translatedValue == null)
      {
      throw new MissingResourceException("Can't find resource for bundle",
      getBundleName(),
      key);
      }

      Although the bundle name and key is passed to the exception, it does not get included in the message in the log, this information should be included in the first parameter.

      ========

      This issue is to track the needed improvement in logging here to improve debug-ability. Will provide a patch soon.

      Attachments

        1. TRINIDAD-2473.trunk.patch
          9 kB
          Prakash Udupa
        2. TRINIDAD-2473-take-2.trunk.patch
          25 kB
          Prakash Udupa
        3. TRINIDAD-2473-take-3.trunk.patch
          26 kB
          Prakash Udupa

        Activity

          People

            jeanne.waldman@oracle.com Jeanne Waldman
            pudupa Prakash Udupa
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

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