[
https://issues.apache.org/jira/browse/WICKET-4203?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13146574#comment-13146574
]
Frank Ziglar commented on WICKET-4203:
--------------------------------------
Hello,
Your patch works like a champ for me!
I was concerned from the linked issue that URIs might have been selected to
provide an extra degree of canonicalization. If the more flexible equality
check of URI is not required, then I agree that toExternalForm() seems ideal
here. And since the URLs all come from ClassLoader.getResources, it does seem
unlikely that this class will encounter equal URLs with different strings (like
different case letters for the schemes).
Thanks!
> Wicket fails to start when deployed filenames contain space characters
> ----------------------------------------------------------------------
>
> Key: WICKET-4203
> URL: https://issues.apache.org/jira/browse/WICKET-4203
> Project: Wicket
> Issue Type: Bug
> Components: wicket
> Affects Versions: 1.5.2
> Reporter: Frank Ziglar
> Assignee: Martin Grigorov
> Attachments: WICKET-4203-externalForm.patch,
> WICKET-4203-loadResources.patch
>
>
> When upgrading from Wicket 1.4 to 1.5, Wicket may fail to start with an
> exception like:
> org.apache.wicket.WicketRuntimeException: java.net.URISyntaxException:
> Illegal character in path at index 12: file:/W:/Dev
> Projects/Portal/website/web/WEB-INF/classes/wicket.properties
> at
> org.apache.wicket.application.AbstractClassResolver.getResources(AbstractClassResolver.java:156)
> at
> org.apache.wicket.Application.initializeComponents(Application.java:491)
> at org.apache.wicket.Application.initApplication(Application.java:808)
> at
> org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:346)
> at
> org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:286)
> at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
> at
> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
> at
> org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:662)
> at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
> at
> org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
> at
> org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
> at
> org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
> at
> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
> at
> org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
> at
> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
> at
> org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
> at org.mortbay.jetty.Server.doStart(Server.java:224)
> at
> org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
> at
> com.google.appengine.tools.development.JettyContainerService.startContainer(JettyContainerService.java:186)
> at
> com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:182)
> at
> com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:172)
> at
> com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:164)
> at
> com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48)
> at
> com.google.appengine.tools.development.DevAppServerMain.<init>(DevAppServerMain.java:113)
> at
> com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:89)
> Caused by: java.net.URISyntaxException: Illegal character in path at index
> 12: file:/W:/Dev Projects/Portal/website/web/WEB-INF/classes/wicket.properties
> at java.net.URI$Parser.fail(URI.java:2809)
> at java.net.URI$Parser.checkChars(URI.java:2982)
> at java.net.URI$Parser.parseHierarchical(URI.java:3066)
> at java.net.URI$Parser.parse(URI.java:3014)
> at java.net.URI.<init>(URI.java:578)
> at java.net.URL.toURI(URL.java:918)
> at
> org.apache.wicket.application.AbstractClassResolver.loadResources(AbstractClassResolver.java:177)
> at
> org.apache.wicket.application.AbstractClassResolver.getResources(AbstractClassResolver.java:139)
> ... 24 more
> This issue was not present in Wicket 1.4.
> The problem could be corrected by moving the deployment path for the
> application to a folder that contains no space characters in the absolute
> path name. However, finding and changing the appropriate configuration
> settings throughout the framework and IDE can be somewhat cumbersome.
> After some investigation, it appears the cause is a change made for
> WICKET-3867, which relies on URL.toURI(). The javadocs for this method state
> that:
> "Note, any URL instance that complies with RFC 2396 can be converted to a
> URI. However, some URLs that are not strictly in compliance can not be
> converted to a URI.". It appears that wicket may not be able to rely on
> ClassLoader.getResources to return a URL which is safe to convert to a URI
> using this method.
> I am humbly supplying a proposed patch, which selects a URI constructor to
> invoke instead of using URL.toURI. The constructors for URI are designed to
> accept paths that are not strictly compliant, and canonicalize them to a
> compliant form. I believe this will correctly construct URIs for equality
> checks, even when the ClassLoader does not return RFC-2396 compliant URLs.
--
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