You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Rafał Krupiński (JIRA)" <ji...@apache.org> on 2012/06/14 13:05:42 UTC

[jira] [Created] (WICKET-4607) Regression in PackageResource.internalGetResourceStream if relative package name and mount path conflicts

Rafał Krupiński created WICKET-4607:
---------------------------------------

             Summary: Regression in PackageResource.internalGetResourceStream if relative package name and mount path conflicts
                 Key: WICKET-4607
                 URL: https://issues.apache.org/jira/browse/WICKET-4607
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 6.0.0-beta2
            Reporter: Rafał Krupiński


In case of conflicting mount-path and relative package name there is a regression:
* in 1.5.x linking to X meant linking to mounted page
* in 6.0 it means linking to package

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Updated] (WICKET-4607) Regression in PackageResource.internalGetResourceStream if relative package name and mount path conflicts

Posted by "Rafał Krupiński (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-4607?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rafał Krupiński updated WICKET-4607:
------------------------------------

    Description: 
After changing from 1.5.6 to 6.0.0-beta2 and going to main page:

Unexpected RuntimeException

Last cause: Access denied to (static) package resource
com/hashnot/nbp. See IPackageResourceGuard
Root cause:

org.apache.wicket.request.resource.PackageResource$PackageResourceBlockedException:
Access denied to (static) package resource com/hashnot/nbp. See
IPackageResourceGuard
at org.apache.wicket.request.resource.PackageResource.internalGetResourceStream(PackageResource.java:459)
[snip]

See attached project
The problem appears when the application mounts a page under the same name as existing subpackage.

In case of conflicting mount-path and relative package name the regression is:
* in 1.5.x linking to X meant linking to mounted page
* in 6.0 it means linking to package

  was:
In case of conflicting mount-path and relative package name there is a regression:
* in 1.5.x linking to X meant linking to mounted page
* in 6.0 it means linking to package

    
> Regression in PackageResource.internalGetResourceStream if relative package name and mount path conflicts
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-4607
>                 URL: https://issues.apache.org/jira/browse/WICKET-4607
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 6.0.0-beta2
>            Reporter: Rafał Krupiński
>              Labels: patch
>         Attachments: guard-regression.zip
>
>
> After changing from 1.5.6 to 6.0.0-beta2 and going to main page:
> Unexpected RuntimeException
> Last cause: Access denied to (static) package resource
> com/hashnot/nbp. See IPackageResourceGuard
> Root cause:
> org.apache.wicket.request.resource.PackageResource$PackageResourceBlockedException:
> Access denied to (static) package resource com/hashnot/nbp. See
> IPackageResourceGuard
> at org.apache.wicket.request.resource.PackageResource.internalGetResourceStream(PackageResource.java:459)
> [snip]
> See attached project
> The problem appears when the application mounts a page under the same name as existing subpackage.
> In case of conflicting mount-path and relative package name the regression is:
> * in 1.5.x linking to X meant linking to mounted page
> * in 6.0 it means linking to package

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (WICKET-4607) Regression in PackageResource.internalGetResourceStream if relative package name and mount path conflicts

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

Martin Grigorov commented on WICKET-4607:
-----------------------------------------

The problem is in AutoLinkResolver. 
For some reason it believes the url points to a resource instead to a page.
                
> Regression in PackageResource.internalGetResourceStream if relative package name and mount path conflicts
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-4607
>                 URL: https://issues.apache.org/jira/browse/WICKET-4607
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 6.0.0-beta2
>            Reporter: Rafał Krupiński
>         Attachments: guard-regression.zip
>
>
> After changing from 1.5.6 to 6.0.0-beta2 and going to main page:
> Unexpected RuntimeException
> Last cause: Access denied to (static) package resource
> com/hashnot/nbp. See IPackageResourceGuard
> Root cause:
> org.apache.wicket.request.resource.PackageResource$PackageResourceBlockedException:
> Access denied to (static) package resource com/hashnot/nbp. See
> IPackageResourceGuard
> at org.apache.wicket.request.resource.PackageResource.internalGetResourceStream(PackageResource.java:459)
> [snip]
> See attached project
> The problem appears when the application mounts a page under the same name as existing subpackage.
> In case of conflicting mount-path and relative package name the regression is:
> * in 1.5.x linking to X meant linking to mounted page
> * in 6.0 it means linking to package

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (WICKET-4607) Regression in PackageResource.internalGetResourceStream if relative package name and mount path conflicts

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

Martin Grigorov commented on WICKET-4607:
-----------------------------------------

Mail discussion: http://markmail.org/thread/zsdrk3m77kxgjvun
                
> Regression in PackageResource.internalGetResourceStream if relative package name and mount path conflicts
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-4607
>                 URL: https://issues.apache.org/jira/browse/WICKET-4607
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 6.0.0-beta2
>            Reporter: Rafał Krupiński
>              Labels: patch
>         Attachments: guard-regression.zip
>
>
> After changing from 1.5.6 to 6.0.0-beta2 and going to main page:
> Unexpected RuntimeException
> Last cause: Access denied to (static) package resource
> com/hashnot/nbp. See IPackageResourceGuard
> Root cause:
> org.apache.wicket.request.resource.PackageResource$PackageResourceBlockedException:
> Access denied to (static) package resource com/hashnot/nbp. See
> IPackageResourceGuard
> at org.apache.wicket.request.resource.PackageResource.internalGetResourceStream(PackageResource.java:459)
> [snip]
> See attached project
> The problem appears when the application mounts a page under the same name as existing subpackage.
> In case of conflicting mount-path and relative package name the regression is:
> * in 1.5.x linking to X meant linking to mounted page
> * in 6.0 it means linking to package

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Commented] (WICKET-4607) Regression in PackageResource.internalGetResourceStream if relative package name and mount path conflicts

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

Martin Grigorov commented on WICKET-4607:
-----------------------------------------

The change that caused this behavior is https://github.com/apache/wicket/commit/04bb9046fe21e91f2968998c1d0efd5a94602655#L0R30
In Wicket 1.5 ResourceNameIterator produces names like "mypackage/sub1." and because of the trailing dot it doesn't match when asking the class loader for such resource.
In 6.x Wicket (I believe correctly) do not put this dot at the end but now cases like yours fail.
The problem is that you use the same mount point as the package name - sub1/sub2 - and later 'mypackage/sub1' is an existing resource according to ClassLoader#getResource().

The fix is as simple as:
--- a/wicket-core/src/main/java/org/apache/wicket/core/util/resource/locator/ExtensionResourceNameIterator.java
+++ b/wicket-core/src/main/java/org/apache/wicket/core/util/resource/locator/ExtensionResourceNameIterator.java
@@ -27,7 +27,7 @@ import java.util.Iterator;
  */
 public class ExtensionResourceNameIterator implements Iterator<String>
 {
-       private static final Iterable<String> NULL_ITERABLE = Arrays.asList((String)null);
+       private static final Iterable<String> NULL_ITERABLE = Arrays.asList("");

But this leads to many failing tests in Wicket.
I'm not sure I want to spend more time on this corner case.


                
> Regression in PackageResource.internalGetResourceStream if relative package name and mount path conflicts
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-4607
>                 URL: https://issues.apache.org/jira/browse/WICKET-4607
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 6.0.0-beta2
>            Reporter: Rafał Krupiński
>         Attachments: guard-regression.zip
>
>
> After changing from 1.5.6 to 6.0.0-beta2 and going to main page:
> Unexpected RuntimeException
> Last cause: Access denied to (static) package resource
> com/hashnot/nbp. See IPackageResourceGuard
> Root cause:
> org.apache.wicket.request.resource.PackageResource$PackageResourceBlockedException:
> Access denied to (static) package resource com/hashnot/nbp. See
> IPackageResourceGuard
> at org.apache.wicket.request.resource.PackageResource.internalGetResourceStream(PackageResource.java:459)
> [snip]
> See attached project
> The problem appears when the application mounts a page under the same name as existing subpackage.
> In case of conflicting mount-path and relative package name the regression is:
> * in 1.5.x linking to X meant linking to mounted page
> * in 6.0 it means linking to package

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Resolved] (WICKET-4607) Regression in PackageResource.internalGetResourceStream if relative package name and mount path conflicts

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

Martin Grigorov resolved WICKET-4607.
-------------------------------------

    Resolution: Won't Fix

This behavior happened to work in 1.5 by chance and wont be supported in 6.x+.

See http://markmail.org/thread/ll4deziqqqqa35mw
                
> Regression in PackageResource.internalGetResourceStream if relative package name and mount path conflicts
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-4607
>                 URL: https://issues.apache.org/jira/browse/WICKET-4607
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 6.0.0-beta2
>            Reporter: Rafał Krupiński
>         Attachments: guard-regression.zip
>
>
> After changing from 1.5.6 to 6.0.0-beta2 and going to main page:
> Unexpected RuntimeException
> Last cause: Access denied to (static) package resource
> com/hashnot/nbp. See IPackageResourceGuard
> Root cause:
> org.apache.wicket.request.resource.PackageResource$PackageResourceBlockedException:
> Access denied to (static) package resource com/hashnot/nbp. See
> IPackageResourceGuard
> at org.apache.wicket.request.resource.PackageResource.internalGetResourceStream(PackageResource.java:459)
> [snip]
> See attached project
> The problem appears when the application mounts a page under the same name as existing subpackage.
> In case of conflicting mount-path and relative package name the regression is:
> * in 1.5.x linking to X meant linking to mounted page
> * in 6.0 it means linking to package

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

[jira] [Updated] (WICKET-4607) Regression in PackageResource.internalGetResourceStream if relative package name and mount path conflicts

Posted by "Rafał Krupiński (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-4607?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rafał Krupiński updated WICKET-4607:
------------------------------------

    Attachment: guard-regression.zip

Test code that reproduces the problem. contains configured jetty
                
> Regression in PackageResource.internalGetResourceStream if relative package name and mount path conflicts
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: WICKET-4607
>                 URL: https://issues.apache.org/jira/browse/WICKET-4607
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 6.0.0-beta2
>            Reporter: Rafał Krupiński
>              Labels: patch
>         Attachments: guard-regression.zip
>
>
> In case of conflicting mount-path and relative package name there is a regression:
> * in 1.5.x linking to X meant linking to mounted page
> * in 6.0 it means linking to package

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira