FULL JDK VERSION(S)
1.4.2_08-b03, 1.5.0_03-b07 and 1.6.0-ea-b37
DESCRIPTION:
#----------------------- Implies.java ---------------------------
import java.io.*;
class Implies {
FilePermission permission;
Implies() {
permission = new FilePermission("/tmp/*", "read");
FilePermission directoryPermission = new FilePermission("/tmp", "read");
if(permission.implies(directoryPermission)) {
System.out.println("permission implied for the directory");
} else {
System.out.println("permission is not implied for the directory");
}
}
public static void main(String[] args) {
Implies i = new Implies();
}
}
#----------------------- How to run ---------------------------
$ javac Implies.java
$ java Implies
#----------------------- Result ---------------------------
permission is not implied for the directory
#----------------------- Javadoc ---------------------------
Javadoc for the FilePermission constructor states
A pathname that ends in "/*" (where "/" is the file separator character,
File.separatorChar) indicates a directory and all the files contained
in that directory.
The implies() method states:
For example, "/tmp/*" implies "/tmp/foo", since "/tmp/*" encompasses the
"/tmp" directory and all files in that directory, including the one named
"foo".
However the javadoc for the FilePermission class states:
A pathname that ends in "/*" (where "/" is the file separator character,
File.separatorChar) indicates all the files and directories contained
in that directory.
The question is does /tmp/* include the /tmp directory as well as the
files contained in the directory? In two places, the javadoc states
that it is, while in one it doesn't. The testcase shows that in the
implementation, the directory is not included.
The javadoc should be changed as appropriate.
###@###.### 2005-05-23 16:16:07 GMT
1.4.2_08-b03, 1.5.0_03-b07 and 1.6.0-ea-b37
DESCRIPTION:
#----------------------- Implies.java ---------------------------
import java.io.*;
class Implies {
FilePermission permission;
Implies() {
permission = new FilePermission("/tmp/*", "read");
FilePermission directoryPermission = new FilePermission("/tmp", "read");
if(permission.implies(directoryPermission)) {
System.out.println("permission implied for the directory");
} else {
System.out.println("permission is not implied for the directory");
}
}
public static void main(String[] args) {
Implies i = new Implies();
}
}
#----------------------- How to run ---------------------------
$ javac Implies.java
$ java Implies
#----------------------- Result ---------------------------
permission is not implied for the directory
#----------------------- Javadoc ---------------------------
Javadoc for the FilePermission constructor states
A pathname that ends in "/*" (where "/" is the file separator character,
File.separatorChar) indicates a directory and all the files contained
in that directory.
The implies() method states:
For example, "/tmp/*" implies "/tmp/foo", since "/tmp/*" encompasses the
"/tmp" directory and all files in that directory, including the one named
"foo".
However the javadoc for the FilePermission class states:
A pathname that ends in "/*" (where "/" is the file separator character,
File.separatorChar) indicates all the files and directories contained
in that directory.
The question is does /tmp/* include the /tmp directory as well as the
files contained in the directory? In two places, the javadoc states
that it is, while in one it doesn't. The testcase shows that in the
implementation, the directory is not included.
The javadoc should be changed as appropriate.
###@###.### 2005-05-23 16:16:07 GMT