Prakash Udupa created TRINIDAD-2421:
---------------------------------------

             Summary: NullPointerException when property not resolvable through 
-tr-property-ref
                 Key: TRINIDAD-2421
                 URL: https://issues.apache.org/jira/browse/TRINIDAD-2421
             Project: MyFaces Trinidad
          Issue Type: Bug
          Components: Skinning
    Affects Versions: 2.0.1-core
            Reporter: Prakash Udupa


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.




--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to