diff options
author | Tom Tromey <tromey@redhat.com> | 2003-08-06 19:47:24 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2003-08-06 19:47:24 +0000 |
commit | 333384df239a366f7e017c6fb86ec52be139191a (patch) | |
tree | 382a2a5b30fb66ad7c47090c57e3b8fce848ec2b /libjava/java | |
parent | 8b82c52809e3ed72ae20c7b17725c34370cad1cf (diff) | |
download | gcc-333384df239a366f7e017c6fb86ec52be139191a.zip gcc-333384df239a366f7e017c6fb86ec52be139191a.tar.gz gcc-333384df239a366f7e017c6fb86ec52be139191a.tar.bz2 |
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
Diffstat (limited to 'libjava/java')
-rw-r--r-- | libjava/java/io/FilePermission.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libjava/java/io/FilePermission.java b/libjava/java/io/FilePermission.java index a86c7c9..7d3e0af 100644 --- a/libjava/java/io/FilePermission.java +++ b/libjava/java/io/FilePermission.java @@ -144,9 +144,10 @@ public final class FilePermission extends Permission implements Serializable /* 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 @@ public final class FilePermission extends Permission implements Serializable } 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; |