Patch: FYI: fixlet in FilePermission
Tom Tromey
tromey@redhat.com
Wed Aug 6 20:21:00 GMT 2003
I'm checking this in on the trunk.
This fixes a small bug in FilePermission pointed out by Gary Benson.
I'm also checking this in to Classpath.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* java/io/FilePermission.java (equals): Use correct index for
last character of path.
Index: java/io/FilePermission.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/io/FilePermission.java,v
retrieving revision 1.6
diff -u -r1.6 FilePermission.java
--- java/io/FilePermission.java 23 Mar 2003 19:11:19 -0000 1.6
+++ java/io/FilePermission.java 6 Aug 2003 19:43:10 -0000
@@ -144,9 +144,10 @@
/* Compare names, taking into account if they refer to a
* directory and one has a separator and the other does not.
*/
- if(f1.charAt(f1.length()) == File.separatorChar)
+ if(f1.length() > 0 && f1.charAt(f1.length() - 1) == File.separatorChar)
{
- if(f2.charAt(f2.length()) == File.separatorChar)
+ if(f2.length() > 0
+ && f2.charAt(f2.length() - 1) == File.separatorChar)
{
if(!f2.equals(f1))
return false;
@@ -159,7 +160,8 @@
}
else
{
- if(f2.charAt(f2.length()) == File.separatorChar)
+ if(f2.length() > 0
+ && f2.charAt(f2.length() - 1) == File.separatorChar)
{
if(!f1.equals(f2.substring(0,f2.length()-1)))
return false;
More information about the Java-patches
mailing list