Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
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