This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: FYI: fixlet in FilePermission


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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]