You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Mike Anderson <MM...@novell.com> on 2000/10/25 22:55:59 UTC

[Patch] Another update for FileUtil.java

I found another problem on NetWare with path handling, particularly with JSP's.  It seems that in some cases, we were getting multiple "\\" characters in the path and they weren't being parsed out correctly on NetWare with the 1.2 Beta JVM.  This patch addresses that problem and only affects the NetWare platform.  If possible, I'd like to get this into the 3.2 branch since that will be the first release that has updates for NetWare.  Please let me know if this can be patched in.

cvs -q diff FileUtil.java (in directory D:\Jakarta\jakarta-tomcat\src\share\org\apache\tomcat\util\)
Index: FileUtil.java
===================================================================
RCS file: /home/cvspublic/jakarta-tomcat/src/share/org/apache/tomcat/util/FileUtil.java,v
retrieving revision 1.9.2.4
diff -r1.9.2.4 FileUtil.java
270c270
< 	// fix path on NetWare
---
> 	// fix path on NetWare - all '/' become '\\' and remove duplicate '\\'
273,274c273,284
< 	    path.indexOf(':') > 0)
< 	    patchPath = patchPath.replace('/', '\\');
---
> 	    path.indexOf(':') > 0) {
> 	    char[] ca = patchPath.replace('/', '\\').toCharArray();
> 	    StringBuffer sb = new StringBuffer();
> 
> 	    for (int i = 0; i < ca.length; i++) {
> 		if ((ca[i] != '\\') ||
> 		    (ca[i] == '\\' && i > 0 && ca[i - 1] != '\\')) {
> 		    sb.append(ca[i]);
> 		}
> 	    }
> 	    patchPath = sb.toString();
> 	}

Thanks,

Mike Anderson
Senior Software Engineer
Platform Services Group
mmanders@novell.com
Novell, Inc., the leading provider of Net services software
www.novell.com