This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: FYI: fixlet in FilePermission
- From: Tom Tromey <tromey at redhat dot com>
- To: GCC libjava patches <java-patches at gcc dot gnu dot org>
- Date: 06 Aug 2003 13:36:58 -0600
- Subject: Patch: FYI: fixlet in FilePermission
- Reply-to: tromey at redhat dot com
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;