[
https://issues.apache.org/jira/browse/SLING-3547?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13992732#comment-13992732
]
Konrad Windszus edited comment on SLING-3547 at 5/8/14 1:41 PM:
----------------------------------------------------------------
The above pull requests add a test around that and provides the fix for it as
well.
was (Author: kwin):
The referenced pull request shows the issue here. I am not sure how to fix
because obviously just changing the comparison to the according object wrapper
class leads to another error during setting the field (because arrays are not
automatically boxed)!
> 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)