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

NullPointerException when property not resolvable through -tr-property-ref

    XMLWordPrintableJSON

Details

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

    Description

      The bug:
      -----------
      Suppose in an application's skin file there is a selector definition with a custom skin property '-tr-cjk-font-family' like the following:

      tr|mySelectorInternal::title{
      -tr-cjk-font-family: -tr-property-ref("tr|mySelector","font-family");
      }

      ...and then "font-family" is not defined anywhere for the selector "tr|mySelector". This will lead to the following NPE...

      java.lang.NullPointerException
      at java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:881)
      at org.apache.myfaces.trinidadinternal.style.cache.FileSystemStyleCache._getStyleContextResolvedSkinProperties(FileSystemStyleCache.java:790)
      at org.apache.myfaces.trinidadinternal.style.cache.FileSystemStyleCache._createEntry(FileSystemStyleCache.java:605)
      at org.apache.myfaces.trinidadinternal.style.cache.FileSystemStyleCache._getEntry(FileSystemStyleCache.java:465)
      at org.apache.myfaces.trinidadinternal.style.cache.FileSystemStyleCache.getStyleSheetURIs(FileSystemStyleCache.java:183)...

      And when this NPE happens, applications are completely broken.

      It is perfectly fine for a property to not resolve through tr-property-ref due to missing dependencies, it is the skinning framework code that should handle this case gracefully. We should just not try to add a null value to ConcurrentHashMap in the above code path.

      I'll attach a patch with simple code addition that does a not-null check to cover this case.

      Attachments

        1. TRINIDAD-2421_over_trunk.patch
          0.8 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 - 2h
                2h
                Remaining:
                Remaining Estimate - 2h
                2h
                Logged:
                Time Spent - Not Specified
                Not Specified