[
https://issues.apache.org/jira/browse/OPENEJB-1986?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13904048#comment-13904048
]
Polina Genova commented on OPENEJB-1986:
----------------------------------------
Hi,
I’m reopening the issue as the same problem reproduces on Tomee 1.6.0 with
other reserved characters – for example ‘%’. It can be reproduced by renaming
the attached application to application with name containing ‘%’.
It’s deployment fails with:
SEVERE: Unable to deploy collapsed ear in war StandardEngine[Catalina].StandardH
ost[localhost].StandardContext[/Space%AppTest1]
java.lang.IllegalArgumentException
at java.net.URI.create(URI.java:842)
at org.apache.openejb.util.URLs.uri(URLs.java:90)
at org.apache.openejb.config.AutoConfig.resolveDestinationLinks(AutoConf
ig.java:594)
at org.apache.openejb.config.AutoConfig.deploy(AutoConfig.java:188)
at org.apache.openejb.config.ConfigurationFactory$Chain.deploy(Configura
tionFactory.java:396)
at org.apache.openejb.config.ConfigurationFactory.configureApplication(C
onfigurationFactory.java:938)
at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWeb
AppBuilder.java:1171)
at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWe
bAppBuilder.java:1051)
at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(Global
ListenerSupport.java:127)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBa
se.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContex
t.java:5322)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:87
7)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:983)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:
1660)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:44
1)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
utor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.net.URISyntaxException: Malformed escape pair at index 5: Space%
AppTest1
at java.net.URI$Parser.fail(URI.java:2809)
at java.net.URI$Parser.scanEscape(URI.java:2939)
at java.net.URI$Parser.scan(URI.java:2962)
at java.net.URI$Parser.checkChars(URI.java:2980)
at java.net.URI$Parser.parseHierarchical(URI.java:3066)
at java.net.URI$Parser.parse(URI.java:3024)
at java.net.URI.<init>(URI.java:578)
at java.net.URI.create(URI.java:840)
... 23 more
I checked that in the code the following handling of the input uri is made (in
org.apache.openejb.util.URLs.uri(URLs.java:90)):
return URI.create(uri.replace(" ", "%20").replace("#", "%23"));
But with this only " ” and “#” are encoded. There are other symbols (such as
‘%’ , ‘I’ or ‘^’) that can break URI.create invocation and they should be
encoded as well.
So why no use a standard utility for url encoding such as java.net.URLEncoder?
Thanks and regards,
Polina
> Deployment of web application with white spaces in its name fails due to
> unencoded characters
> ---------------------------------------------------------------------------------------------
>
> Key: OPENEJB-1986
> URL: https://issues.apache.org/jira/browse/OPENEJB-1986
> Project: OpenEJB
> Issue Type: Bug
> Components: configuration, deployment
> Reporter: Polina Genova
> Assignee: Romain Manni-Bucau
> Fix For: 4.5.2, 4.6.0.beta1
>
> Attachments: Space AppTest.war
>
>
> Hi,
> The deployment of web applications with special characters (such as white
> spaces) in the name fails with the following exception (tested on Tomee
> Webprofile 1.5.1).
> To reproduce simply deploy the attached test application:
> SEVERE: Unable to deploy collapsed ear in war
> StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Space
> AppTest]
> java.lang.IllegalArgumentException
> at java.net.URI.create(URI.java:842)
> at
> org.apache.openejb.config.AutoConfig.resolveDestinationLinks(AutoConfig.java:582)
> at org.apache.openejb.config.AutoConfig.deploy(AutoConfig.java:183)
> at
> org.apache.openejb.config.ConfigurationFactory$Chain.deploy(ConfigurationFactory.java:338)
> at
> org.apache.openejb.config.ConfigurationFactory.configureApplication(ConfigurationFactory.java:827)
> at
> org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:974)
> at
> org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:901)
> at
> org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:118)
> at
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
> at
> org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
> at
> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5173)
> at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
> at
> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
> at
> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
> at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
> at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:977)
> at
> org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1655)
> at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> at java.lang.Thread.run(Thread.java:662)
> Caused by: java.net.URISyntaxException: Illegal character in path at index 5:
> Space AppTest
> 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:3024)
> at java.net.URI.<init>(URI.java:578)
> at java.net.URI.create(URI.java:840)
> ... 22 more
> The exception is due to incorrect construction of URL in
> org.apache.openejb.config.AutoConfig class.
> To make special characters legal in this case, they need to be first encoded
> before passing them to the URI factory method create.
> For example:
> URI.create(URLEncoder.encode(webModule.getModuleId()));
> I’ve successfully tested this fix using the standard java.net.Encoder (as I
> could not find any other internal encoding utility).
> Thanks and regards,
> Polina
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)