###@###.### (Ken Arnold - Sun Labs
All platforms: File.getParent() does not return the parent directory, it should return ".." or the name of the parent directory in a file-system specific way.
If you create the File object without specifying the directory, File.getParent() returns null.
Steps to reproduce
Compile and run the following code
import java.io.*;
class FileMethods
{
public static void main(String[] args)
{
File src = new File(".", "File.java");
System.out.println("getName() = " + src.getName() );
System.out.println("getPath() = " + src.getPath());
System.out.println("getAbsolutePath() = " + src.getAbsolutePath());
System.out.println("getParent() = " + src.getParent());
// without directory specified.
src = new File("File.java");
System.out.println("getName() = " + src.getName() );
System.out.println("getPath() = " + src.getPath());
System.out.println("getAbsolutePath() = " + src.getAbsolutePath());
System.out.println("getParent() = " + src.getParent());
}
}
The description field as copied from bug report 1248081 follows:
if /tmp is set to be the value for acl.read and acl.write, then one can use
any relative path from /tmp to access any directory. for example,
/tmp/../home/smani --> and perform read and write operations.
Venkat.Rao@eng wrote a sample program to verify this:
http://hubcap.eng/secure/Test.html
All platforms: File.getParent() does not return the parent directory, it should return ".." or the name of the parent directory in a file-system specific way.
If you create the File object without specifying the directory, File.getParent() returns null.
Steps to reproduce
Compile and run the following code
import java.io.*;
class FileMethods
{
public static void main(String[] args)
{
File src = new File(".", "File.java");
System.out.println("getName() = " + src.getName() );
System.out.println("getPath() = " + src.getPath());
System.out.println("getAbsolutePath() = " + src.getAbsolutePath());
System.out.println("getParent() = " + src.getParent());
// without directory specified.
src = new File("File.java");
System.out.println("getName() = " + src.getName() );
System.out.println("getPath() = " + src.getPath());
System.out.println("getAbsolutePath() = " + src.getAbsolutePath());
System.out.println("getParent() = " + src.getParent());
}
}
The description field as copied from bug report 1248081 follows:
if /tmp is set to be the value for acl.read and acl.write, then one can use
any relative path from /tmp to access any directory. for example,
/tmp/../home/smani --> and perform read and write operations.
Venkat.Rao@eng wrote a sample program to verify this:
http://hubcap.eng/secure/Test.html