1 |
/* java.lang.FilePermission |
/* FilePermission.java -- |
2 |
Copyright (C) 1998, 2000, 2003, 2004 Free Software Foundation, Inc. |
Copyright (C) 1998, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
7 |
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
8 |
the Free Software Foundation; either version 2, or (at your option) |
the Free Software Foundation; either version 2, or (at your option) |
9 |
any later version. |
any later version. |
10 |
|
|
11 |
GNU Classpath is distributed in the hope that it will be useful, but |
GNU Classpath is distributed in the hope that it will be useful, but |
12 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
42 |
|
|
43 |
public final class FilePermission extends Permission implements Serializable |
public final class FilePermission extends Permission implements Serializable |
44 |
{ |
{ |
45 |
static final long serialVersionUID = 7930732926638008763L; |
private static final long serialVersionUID = 7930732926638008763L; |
46 |
|
|
47 |
private static final String CURRENT_DIRECTORY = |
private static final String CURRENT_DIRECTORY = |
48 |
System.getProperty("user.dir"); |
System.getProperty("user.dir"); |
49 |
|
|
50 |
|
private static final String ALL_FILES = "<<ALL FILES>>"; |
51 |
|
|
52 |
private boolean readPerm = false; |
private boolean readPerm = false; |
53 |
private boolean writePerm = false; |
private boolean writePerm = false; |
54 |
private boolean executePerm = false; |
private boolean executePerm = false; |
202 |
*/ |
*/ |
203 |
public boolean implies(Permission p) |
public boolean implies(Permission p) |
204 |
{ |
{ |
|
FilePermission fp; |
|
|
|
|
205 |
if (! (p instanceof FilePermission)) |
if (! (p instanceof FilePermission)) |
206 |
return false; |
return false; |
207 |
|
|
|
fp = (FilePermission) p; |
|
|
|
|
208 |
String f1 = getName(); |
String f1 = getName(); |
209 |
|
|
210 |
|
if (f1.equals(ALL_FILES)) |
211 |
|
return true; |
212 |
|
|
213 |
|
FilePermission fp = (FilePermission) p; |
214 |
String f2 = fp.getName(); |
String f2 = fp.getName(); |
215 |
|
|
216 |
if (f1.charAt(0) != File.separatorChar) |
if (f1.charAt(0) != File.separatorChar) |