[
https://issues.apache.org/jira/browse/SLING-3547?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13992731#comment-13992731
]
ASF GitHub Bot commented on SLING-3547:
---------------------------------------
GitHub user kwin opened a pull request:
https://github.com/apache/sling/pull/16
SLING-3547, add test for numerical defaults (both boolean and long,
test exposing the wrong behaviour of numerical defaults in Sling Models
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/kwin/sling SLING-3547
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/sling/pull/16.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #16
----
commit 63b59bceecae1670a58da257d9165a5905a52075
Author: Konrad Windszus <[email protected]>
Date: 2014-05-08T12:37:19Z
SLING-3547, add test for numerical defaults (both boolean and long,
primitive and object wrapper)
----
> 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)