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]

FYI: Patch: java.io.FilePermission


Hi list,


I just commited the attached patch which fixes an off-by-one error.


Michael


2004-03-19  Mark Wielaard  <mark@klomp.org>

	Reported by Stephen Crawley
	* java/io/FilePermission.java (implies): Use String.length() -1 to
	access last char of String.
Index: java/io/FilePermission.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/io/FilePermission.java,v
retrieving revision 1.9
diff -u -b -B -r1.9 FilePermission.java
--- java/io/FilePermission.java	4 Dec 2003 20:09:57 -0000	1.9
+++ java/io/FilePermission.java	19 Mar 2004 22:01:24 -0000
@@ -271,9 +271,9 @@
       break;
 */
         default:
-          if(f2.charAt(f2.length()) == File.separatorChar) 
+          if(f2.charAt(f2.length() - 1) == File.separatorChar) 
             {
-              if(!f1.equals(f2.substring(0,f2.length()-1)))
+              if(!f1.equals(f2.substring(0,f2.length() - 1)))
 	        return false;
             } 
           else 

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