aboutsummaryrefslogtreecommitdiff
path: root/libjava/java
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2003-08-06 19:47:24 +0000
committerTom Tromey <tromey@gcc.gnu.org>2003-08-06 19:47:24 +0000
commit333384df239a366f7e017c6fb86ec52be139191a (patch)
tree382a2a5b30fb66ad7c47090c57e3b8fce848ec2b /libjava/java
parent8b82c52809e3ed72ae20c7b17725c34370cad1cf (diff)
downloadgcc-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.java8
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;