With that change I wanted to improve consistency of ResourceNameIterator.

Yes, we have a regression now. But IMHO it was pure luck that this 'bug' 
happened to work in 1.5.x

Sven

"Martin Grigorov (JIRA)" <[email protected]> schrieb:

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

Reply via email to