[jira] [Commented] (SLING-2988) Support primitive types for ValueMap.get()
[ https://issues.apache.org/jira/browse/SLING-2988?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13730645#comment-13730645 ] Carsten Ziegeler commented on SLING-2988: - We discussed this in SLING-2712, throwing an IAE would be a contract change Support primitive types for ValueMap.get() -- Key: SLING-2988 URL: https://issues.apache.org/jira/browse/SLING-2988 Project: Sling Issue Type: Improvement Components: JCR Affects Versions: JCR Resource 2.1.0 Reporter: Konrad Windszus Currently the call for ValueMap.get(name, boolean.class) returns null while ValueMap.get(name, Boolean.class) returns true for a JCR property with type String having the value true. Please either throw an exception if primitive classes are given as second argument or support them as well. Just returning null is confusing, because it is not obvious from the Javadoc that no JCR attribute can be converted into a primitive. Currently the Javadoc states that this call either returns null or the value. Assigning null to a primitive would lead to an NPE. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (SLING-2988) Support primitive types for ValueMap.get()
[ https://issues.apache.org/jira/browse/SLING-2988?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13725057#comment-13725057 ] Carsten Ziegeler commented on SLING-2988: - From the javadocs of ValueMap: * This method does not support conversion into a primitive type or an * array of a primitive type. It should return codenull/code in this * case. Support primitive types for ValueMap.get() -- Key: SLING-2988 URL: https://issues.apache.org/jira/browse/SLING-2988 Project: Sling Issue Type: Improvement Components: JCR Affects Versions: JCR Resource 2.1.0 Reporter: Konrad Windszus Currently the call for ValueMap.get(name, boolean.class) returns false while ValueMap.get(name, Boolean.class) returns true for a JCR property with type String having the value true. Please either throw an exception if primitive classes are given as second argument or support them as well. Currently the Javadoc states that this call either returns null or the value. Assigning null to a primitive would lead to an NPE. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (SLING-2988) Support primitive types for ValueMap.get()
[ https://issues.apache.org/jira/browse/SLING-2988?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13725065#comment-13725065 ] Konrad Windszus commented on SLING-2988: Sorry, didn't notice that the Javadoc has been clarified. Only had a look in http://dev.day.com/docs/en/cq/current/javadoc/org/apache/sling/api/resource/ValueMap.html#get%28java.lang.String,%20java.lang.Class%29 and in http://sling.apache.org/apidocs/sling6/org/apache/sling/api/resource/ValueMap.html. But indeed you clarified the javadoc with https://fisheye6.atlassian.com/changelog/sling?cs=1438373. Although I would like it even better if in such a case you would throw an IllegalArgumentException, because not all developers are looking at the javadocs that carefully ;-) Do you think that would break too many implementations relying on ValueMap returning null if a primitive was provided as a parameter? Support primitive types for ValueMap.get() -- Key: SLING-2988 URL: https://issues.apache.org/jira/browse/SLING-2988 Project: Sling Issue Type: Improvement Components: JCR Affects Versions: JCR Resource 2.1.0 Reporter: Konrad Windszus Currently the call for ValueMap.get(name, boolean.class) returns null while ValueMap.get(name, Boolean.class) returns true for a JCR property with type String having the value true. Please either throw an exception if primitive classes are given as second argument or support them as well. Just returning null is confusing, because it is not obvious from the Javadoc that no JCR attribute can be converted into a primitive. Currently the Javadoc states that this call either returns null or the value. Assigning null to a primitive would lead to an NPE. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira