tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ognjen Blagojevic <ognjen.d.blagoje...@gmail.com>
Subject Problem with getRealPath("") on Tomcat 8
Date Fri, 02 Aug 2013 11:07:42 GMT
Hi,

I am just testing Tomcat 8.0.0-RC1 that is proposed for (Alpha) release.

I noticed that (unlike Tomcat 7.0.42) this version throws 
IllegalArgumentException upon calling ServletContext.getRealPath(""). It 
seems that TC8 expects that argument provided to getRealPath is 
non-empty string.

The code that tries to execute getRealPath with empty argument is not 
mine, it is from Apache Axis2 1.6.2 (latest production release). Now, I 
could file a bug with Axis2, but I am actually not sure is it really 
necessary that getRealPath argument is non-empty string?

-Ognjen


P.S. More details below.


Stack trace:

[ERROR] java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
         at 
org.apache.catalina.webresources.AbstractResourceSet.checkPath(AbstractResourceSet.java:39)
         at 
org.apache.catalina.webresources.DirResourceSet.getResource(DirResourceSet.java:91)
         at 
org.apache.catalina.webresources.StandardRoot.getResourceInternal(StandardRoot.java:176)
         at 
org.apache.catalina.webresources.CachedResource.validate(CachedResource.java:62)
         at 
org.apache.catalina.webresources.Cache.getResource(Cache.java:78)
         at 
org.apache.catalina.webresources.StandardRoot.getResource(StandardRoot.java:163)
         at 
org.apache.catalina.core.StandardContext.getRealPath(StandardContext.java:4528)
         at 
org.apache.catalina.core.ApplicationContext.getRealPath(ApplicationContext.java:398)
         at 
org.apache.catalina.core.ApplicationContextFacade.getRealPath(ApplicationContextFacade.java:335)
         at 
org.apache.axis2.deployment.WarBasedAxisConfigurator.<init>(WarBasedAxisConfigurator.java:103)
         at 
org.apache.axis2.transport.http.AxisServlet.initConfigContext(AxisServlet.java:584)
         at 
org.apache.axis2.transport.http.AxisServlet.init(AxisServlet.java:454)
         at 
org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1235)
         at 
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1148)
         at 
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1044)
         at 
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5025)
         at 
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5322)
         at 
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
         at 
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726)
         at 
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:702)
         at 
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:698)
         at 
org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:968)
         at 
org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1742)
         at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
         at 
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
         at java.util.concurrent.FutureTask.run(FutureTask.java:166)
         at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
         at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
         at java.lang.Thread.run(Thread.java:724)


------------------------------

Axis2 code (WarBasedAxisConfigurator.java:103-106):

103:                String webpath = 
config.getServletContext().getRealPath("");
104:                if (webpath == null || webpath.length() == 0) {
105:                    webpath = 
config.getServletContext().getRealPath("/");
106:                }

------------------------------

Tomcat 8 code throwing the exception (AbstractResourceSet.java:37-41):

     protected final void checkPath(String path) {
         if (path == null || path.length() == 0 || path.charAt(0) != '/') {
             throw new IllegalArgumentException();
         }
     }

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message