[ 
https://issues.apache.org/jira/browse/WICKET-2418?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12739610#action_12739610
 ] 

Stefan Schueffler commented on WICKET-2418:
-------------------------------------------

The stacktrace (including the NPE in question) is as:

Caused by: java.lang.NullPointerException
        at 
java.util.concurrent.ConcurrentHashMap.putIfAbsent(ConcurrentHashMap.java:895)
        at org.apache.wicket.SharedResources.add(SharedResources.java:162)
        at org.apache.wicket.ResourceReference.bind(ResourceReference.java:162)
        at 
org.apache.wicket.ResourceReference.getSharedResourceKey(ResourceReference.java:225)

I read this as:
after adding the resource in line 157 of ResourceReference,  the code tries to 
add the "null"-resource in line 162.
("resource" will not be set in case of PackageResource.)

 You either can return (my patch), or to set "resource" to the packageResource.
line 158:
resource = packageResource; 

As the packageresource is added to sharedResource anyway, i do not see the 
benefit of adding it twice beside the missing / additional parameters locale, 
style, etc


> NPE in ResourceReference
> ------------------------
>
>                 Key: WICKET-2418
>                 URL: https://issues.apache.org/jira/browse/WICKET-2418
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.6, 1.3.7, 1.4.0
>            Reporter: Stefan Schueffler
>         Attachments: ResourceReference.java.patch
>
>   Original Estimate: 0.08h
>  Remaining Estimate: 0.08h
>
> Referencing a resource located in a different jar-file (and therefore 
> possibly in a different (parent-)classloader), the ResourceReference fails to 
> add this resource.
> The problem is, that the lookup-and-bind-code after correctly recognizing and 
> adding this PackageResource, falls through to the "normal" resource-add which 
> leads to a NPE in ConcurrentHashMap.
> Fix is trivial, patch is appended.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to