You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Stefan Schueffler (JIRA)" <ji...@apache.org> on 2009/08/05 17:03:14 UTC

[jira] Created: (WICKET-2418) NPE in ResourceReference

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.4.0, 1.3.7, 1.3.6
            Reporter: Stefan Schueffler
            Priority: Blocker


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.


[jira] Commented: (WICKET-2418) NPE in ResourceReference

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2418?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12739564#action_12739564 ] 

Igor Vaynberg commented on WICKET-2418:
---------------------------------------

what null value is causing the npe?

if we do not let it fallthrough then it will not be registered under the locale and style - which may lead to some undesired sideeffects.

this is a more general problem then just the resource laoding. eg if you add a component to the page out of another jar it will not be able to be deserialized because of the same classloader limitation.

i think you will be much better served by setting up your own iclassresolver that knows about the classloader that loads the other jar you are using.

> 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.


[jira] Issue Comment Edited: (WICKET-2418) NPE in ResourceReference

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-2418?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12739564#action_12739564 ] 

Igor Vaynberg edited comment on WICKET-2418 at 8/5/09 8:24 AM:
---------------------------------------------------------------

if we do not let it fallthrough then it will not be registered under the locale and style - which may lead to some undesired sideeffects.

this is a more general problem then just the resource laoding. eg if you add a component to the page out of another jar it will not be able to be deserialized because of the same classloader limitation.

i think you will be much better served by setting up your own iclassresolver that knows about the classloader that loads the other jar you are using.

      was (Author: ivaynberg):
    what null value is causing the npe?

if we do not let it fallthrough then it will not be registered under the locale and style - which may lead to some undesired sideeffects.

this is a more general problem then just the resource laoding. eg if you add a component to the page out of another jar it will not be able to be deserialized because of the same classloader limitation.

i think you will be much better served by setting up your own iclassresolver that knows about the classloader that loads the other jar you are using.
  
> 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.


[jira] Updated: (WICKET-2418) NPE in ResourceReference

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2418?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg updated WICKET-2418:
----------------------------------

    Priority: Major  (was: Blocker)

not a blocker. does it crash the servlet container of every app out there? maybe a blocker to *you* but not to the *userbase* as a whole.

> 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.


[jira] Closed: (WICKET-2418) NPE in ResourceReference

Posted by "Stefan Schueffler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2418?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefan Schueffler closed WICKET-2418.
-------------------------------------


Committed code works as expected.

> 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
>            Assignee: Igor Vaynberg
>             Fix For: 1.4.1
>
>         Attachments: ResourceReference.java.patch, 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.


[jira] Resolved: (WICKET-2418) NPE in ResourceReference

Posted by "Igor Vaynberg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2418?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg resolved WICKET-2418.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 1.4.1
         Assignee: Igor Vaynberg

> 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
>            Assignee: Igor Vaynberg
>             Fix For: 1.4.1
>
>         Attachments: ResourceReference.java.patch, 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.


[jira] Updated: (WICKET-2418) NPE in ResourceReference

Posted by "Stefan Schueffler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2418?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefan Schueffler updated WICKET-2418:
--------------------------------------

    Attachment: ResourceReference.java.patch

This fix simply adds a return-statement to prevent the lookup-code to fall through to the "normal" add-behaviour when adding a PackageResource.

> 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
>            Priority: Blocker
>         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.


[jira] Commented: (WICKET-2418) NPE in ResourceReference

Posted by "Stefan Schueffler (JIRA)" <ji...@apache.org>.
    [ 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.


[jira] Updated: (WICKET-2418) NPE in ResourceReference

Posted by "Stefan Schueffler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-2418?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stefan Schueffler updated WICKET-2418:
--------------------------------------

    Attachment: ResourceReference.java.patch

Just verified in my local test environment... 
Using this patch it also works by adding the packageResource twice (one time without style, name, etc, and one time with) by avoiding the NPE.


> 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, 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.