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
This commit is contained in:
parent
8b82c52809
commit
333384df23
2 changed files with 10 additions and 3 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue