[Patch] java.io.FilePermission
Michael Koch
konqueror@gmx.de
Wed Apr 20 09:10:00 GMT 2005
Hi list,
I just commited the attached patch to merge it from GNU classpath to
HEAD. It adds support to handle the special file "<<ALL FILES>>".
Michael
2005-04-20 Michael Koch <konqueror@gmx.de>
* java/io/FilePermission.java
(serialVersionUID): Made private.
(ALL_FILES): New constant.
(implies): Handle '<<ALL FILES>>' case.
-------------- next part --------------
Index: java/io/FilePermission.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/io/FilePermission.java,v
retrieving revision 1.13
diff -u -r1.13 FilePermission.java
--- java/io/FilePermission.java 6 Nov 2004 23:07:45 -0000 1.13
+++ java/io/FilePermission.java 20 Apr 2005 09:01:09 -0000
@@ -1,5 +1,5 @@
-/* java.lang.FilePermission
- Copyright (C) 1998, 2000, 2003, 2004 Free Software Foundation, Inc.
+/* FilePermission.java --
+ Copyright (C) 1998, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -7,7 +7,7 @@
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -42,11 +42,13 @@
public final class FilePermission extends Permission implements Serializable
{
- static final long serialVersionUID = 7930732926638008763L;
+ private static final long serialVersionUID = 7930732926638008763L;
private static final String CURRENT_DIRECTORY =
System.getProperty("user.dir");
+ private static final String ALL_FILES = "<<ALL FILES>>";
+
private boolean readPerm = false;
private boolean writePerm = false;
private boolean executePerm = false;
@@ -200,14 +202,15 @@
*/
public boolean implies(Permission p)
{
- FilePermission fp;
-
if (! (p instanceof FilePermission))
return false;
- fp = (FilePermission) p;
-
String f1 = getName();
+
+ if (f1.equals(ALL_FILES))
+ return true;
+
+ FilePermission fp = (FilePermission) p;
String f2 = fp.getName();
if (f1.charAt(0) != File.separatorChar)
More information about the Java-patches
mailing list