[ https://issues.apache.org/jira/browse/SLING-11567?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Joerg Hoh closed SLING-11567. ----------------------------- > ValueMap.get() with null defaultValue not working > ------------------------------------------------- > > Key: SLING-11567 > URL: https://issues.apache.org/jira/browse/SLING-11567 > Project: Sling > Issue Type: Bug > Components: JCR > Reporter: Joerg Hoh > Assignee: Joerg Hoh > Priority: Blocker > Fix For: JCR Resource 3.2.2 > > Time Spent: 3h > Remaining Estimate: 0h > > While checking the current state of the JCR Bundle resource bundle against an > existing codebase, I found that it throws errors like this: > {noformat} > Caused by: java.lang.NullPointerException: null > at > org.apache.sling.jcr.resource.internal.JcrValueMap.get(JcrValueMap.java:110) > [org.apache.sling.jcr.resource:3.2.1.SNAPSHOT] > {noformat} > This is caused by calling {{ValueMap.get(propertyName, null)}}. This was > working with the version 3.2.0 of the jcr resource bundle. > The {{defaultValue}} parameter is marked as NonNull, and the javadoc for the > ValueMap.get() method states this: > _Implementation hint: In the past it was allowed to call this with a 2nd > parameter being null. Therefore all implementations should internally call > Map.get(Object) when the 2nd parameter has value null._ > That means that some backward-incompatible change has been made by declaring > this parameter non-null (in the API). > For the implementation that despite this parameter being marked as non-null, > all implementations still need to do explicit checks for null and handle them > properly. -- This message was sent by Atlassian Jira (v8.20.10#820010)