Commit 333384df by Tom Tromey Committed by Tom Tromey

FilePermission.java (equals): Use correct index for last character of path.

	* java/io/FilePermission.java (equals): Use correct index for
	last character of path.

From-SVN: r70206
parent 8b82c528
2003-08-06 Tom Tromey <tromey@redhat.com>
* java/io/FilePermission.java (equals): Use correct index for
last character of path.
2003-08-06 Alan Modra <amodra@bigpond.net.au> 2003-08-06 Alan Modra <amodra@bigpond.net.au>
* acinclude.m4 (LIBGCJ_CONFIGURE): Remove AC_CANONICAL_BUILD. * acinclude.m4 (LIBGCJ_CONFIGURE): Remove AC_CANONICAL_BUILD.
......
...@@ -144,9 +144,10 @@ public final class FilePermission extends Permission implements Serializable ...@@ -144,9 +144,10 @@ public final class FilePermission extends Permission implements Serializable
/* Compare names, taking into account if they refer to a /* Compare names, taking into account if they refer to a
* directory and one has a separator and the other does not. * 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)) if(!f2.equals(f1))
return false; return false;
...@@ -159,7 +160,8 @@ public final class FilePermission extends Permission implements Serializable ...@@ -159,7 +160,8 @@ public final class FilePermission extends Permission implements Serializable
} }
else 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))) if(!f1.equals(f2.substring(0,f2.length()-1)))
return false; return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment