You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Jim Rudnicki <jd...@pacbell.net> on 2000/08/06 12:17:02 UTC
[PATCH]SimpleFileFilter and directories
I was getting a slew of IndexOutOfBounds exceptions at startup. The
fileOrFiles() method has this bit in it:
String fname=f.getName();
if (fname.charAt(0)=='*') {
At least on Win32 with IBM JDK1.1.8, directories end in a slash and yield
null for getName, which in turn throws the exception.
The patch below fixes this and should be platform independent.
Jim
Index: ./src/share/org/apache/tomcat/loader/SimpleFileFilter.java
===================================================================
RCS file:
/home/cvspublic/jakarta-tomcat/src/share/org/apache/tomcat/loader/SimpleFile
Filter.java,v
retrieving revision 1.4
diff -r1.4 SimpleFileFilter.java
105,106d104
< File parent=new File(f.getParent());
< String fname=f.getName();
107a106,113
> /* directories return null for getName()
> Test for these first */
> if( f.isDirectory() ) {
> files=new String[1];
> files[0]=f.getPath();
> return files;
> }
> String fname=f.getName();
109a116
> File parent=new File(f.getParent());
The command completed successfully.