Konrad Windszus created SLING-3547:
--------------------------------------

             Summary: Default handling for numerical types on Sling Models 
broken
                 Key: SLING-3547
                 URL: https://issues.apache.org/jira/browse/SLING-3547
             Project: Sling
          Issue Type: Bug
          Components: Extensions
    Affects Versions: Sling Models Implementation 1.0.2
            Reporter: Konrad Windszus


Currently all default annotations on numeric types lead to the following 
warning: 
org.apache.sling.models.impl.ModelAdapterFactory Default values for class 
java.lang.Boolean are not supported and the default is not used.

This is due to the fact that first all types are converted from Primitives to 
Object Wrapper Classes (in mapPrimitiveClasses). Then the comparison against 
that type only considers Primitives (in getDefaultValue, except for Strings), 
which obviously failed, because either those were Object Wrapper Classes right 
from the beginning, or they were converted to those. 

In my regard you should compare the Type against e.g. Integer.class instead of 
Integer.TYPE (ModelAdapterFactory, line 428ff). Otherwise defaults for 
numerical types will not work.




--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to