harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Elena Sayapina (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-3869) [classlib][luni] Compatibility: File("", "") differs on Harmony and RI
Date Tue, 15 May 2007 10:58:16 GMT
[classlib][luni] Compatibility: File("", "") differs on Harmony and RI
----------------------------------------------------------------------

                 Key: HARMONY-3869
                 URL: https://issues.apache.org/jira/browse/HARMONY-3869
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Elena Sayapina
            Priority: Minor


Constructors File(parent, String child) behave differently on Harmony and RI in case of empty
pathname parent and empty pathname child.

new File("", "").getPath() returns abstract path equals to File.separator while Harmony returns
empty abstract path.

NOTE that if child is not empty Harmony and RI act the same.

Please, consider the following code:

import java.io.File;

public class CFileTest {
	
	public static void main(String[] args) {
		
		System.out.println("user.dir: " + System.getProperty("user.dir"));
		
		File file1 = new File("", "");
		System.out.println("Path 1: " + file1.getPath());
		System.out.println("Absolute path 1: " + file1.getAbsolutePath());
		
		File file2 = new File(new File(""), "");
		System.out.println("Path 2: " + file2.getPath());
		System.out.println("Absolute path 2: " + file2.getAbsolutePath());	
		
		File file3 = new File("", "file");
		System.out.println("Path 3: " + file3.getPath());
		System.out.println("Absolute path 3: " + file3.getAbsolutePath());
	}
}

Output on Harmony-r537771:

Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors,
as applicable.
java version "1.5.0"
pre-alpha : not complete or compatible
svn = r537771, (May 14 2007), Windows/ia32/msvc 1310, release build
http://incubator.apache.org/harmony

user.dir: C:\users\evs

Path 1:
Absolute path 1: C:\users\evs

Path 2:
Absolute path 2: C:\users\evs

Path 3: \file
Absolute path 3: C:\file


Output on HotSpot:

java version "1.5.0_11"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode)

user.dir: C:\users\evs

Path 1: \
Absolute path 1: C:\

Path 2: \
Absolute path 2: C:\

Path 3: \file
Absolute path 3: C:\file


Please, use attached CFileTest.java for the test reproducing.



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message