larryi 01/09/24 20:45:26
Modified: src/share/org/apache/tomcat/modules/config WorkDirSetup.java
Log:
Fix for bug 3803. URLClassLoader has problems with directory names that
contain encoded characters, or at least %2F. Tomcat 3.2.x's
AdaptiveClassLoader apparently did not. WorkDirInterceptor still uses
the encoded context name, but changes all '%' to '_'.
Reported by: John Paul Lorenti
Bug Submitted by: Chris Lamey
Also, modified "useWebInf" mode to include the context path (encoded
with '%' changed to '_') in case a web application is being served by more
than one context.
Some minor code simplification.
Revision Changes Path
1.10 +9 -7
jakarta-tomcat/src/share/org/apache/tomcat/modules/config/WorkDirSetup.java
Index: WorkDirSetup.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/WorkDirSetup.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- WorkDirSetup.java 2001/09/20 03:42:09 1.9
+++ WorkDirSetup.java 2001/09/25 03:45:26 1.10
@@ -185,7 +185,12 @@
StringBuffer sb=new StringBuffer();
sb.append( absPath ).append( File.separator );
sb.append( "WEB-INF" ).append( File.separator );
- sb.append( "TOMCAT_WORKDIR" );
+ sb.append( "TOMCAT_WORKDIR" ).append( File.separator );
+
+ String path=ctx.getPath();
+ if( path.startsWith("/")) path=path.substring(1);
+ if( "".equals(path) ) path="ROOT";
+ sb.append( URLEncoder.encode( path ).replace('%', '_') );
File workDirF= new File( sb.toString() );
workDirF.mkdirs();
@@ -205,17 +210,14 @@
sb.append(cm.getWorkDir());
sb.append(File.separator);
String host=ctx.getHost();
- // # 457
- if( host!=null )
- host=host.replace(':', '_');
if( host==null )
sb.append( "DEFAULT" );
else
- sb.append( host );
+ sb.append( host.replace(':', '_') );
if( oldStyle ) {
- sb.append(URLEncoder.encode( ctx.getPath() ));
+ sb.append(URLEncoder.encode( ctx.getPath() ).replace('%', '_'));
workDirF=new File(sb.toString());
} else {
File hostD=new File( sb.toString());
@@ -224,7 +226,7 @@
String path=ctx.getPath();
if( path.startsWith("/")) path=path.substring(1);
if( "".equals(path) ) path="ROOT";
- workDirF=new File( hostD, URLEncoder.encode( path ));
+ workDirF=new File( hostD, URLEncoder.encode( path ).replace('%', '_') );
}
ctx.setWorkDir( workDirF );
}