harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mloe...@apache.org
Subject svn commit: r400027 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/io/File.java test/java/tests/api/java/io/FileTest.java
Date Fri, 05 May 2006 09:30:02 GMT
Author: mloenko
Date: Fri May  5 02:29:57 2006
New Revision: 400027

URL: http://svn.apache.org/viewcvs?rev=400027&view=rev
Log:
fixes for HARMONY-382
File(String, String) and File(File, String) constructors doesn't work properly if first argument
is null

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/FileTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java?rev=400027&r1=400026&r2=400027&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java
Fri May  5 02:29:57 2006
@@ -97,7 +97,7 @@
 	public File(File dir, String name) {
 		if (name != null) {
 			if (dir == null) {
-				this.path = name;
+				this.path = fixSlashes(name);
 			} else {
 				this.path = calculatePath(dir.getPath(),name);
 			}
@@ -128,7 +128,7 @@
 	public File(String dirPath, String name) {
 		if (name != null) {
 			if (dirPath == null) {
-				this.path = name;
+				this.path = fixSlashes(name);
 			} else {
 				this.path = calculatePath(dirPath, name);
 			}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/FileTest.java
URL: http://svn.apache.org/viewcvs/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/FileTest.java?rev=400027&r1=400026&r2=400027&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/FileTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/FileTest.java
Fri May  5 02:29:57 2006
@@ -26,7 +26,6 @@
 import java.net.URISyntaxException;
 import java.net.URL;
 
-import tests.support.Support_Exec;
 import tests.support.Support_PlatformFile;
 
 public class FileTest extends junit.framework.TestCase {
@@ -99,6 +98,13 @@
 		f = new File(d, "input.tst");
 		assertTrue("Test 2: Created Incorrect File " + f.getPath(), f
 				.getAbsolutePath().equals(dirName));
+
+		// Regression test for Harmony-382
+        File s = null;
+        f = new File("/abc");
+        d = new File(s, "/abc");
+        assertEquals("Test3: Created Incorrect File " + d.getAbsolutePath(), f
+                .getAbsolutePath(), d.getAbsolutePath());
 	}
 
 	/**
@@ -150,6 +156,13 @@
 		f = new File(dirName, fileName);
 		assertTrue("Test 2: Created Incorrect File", f.getPath()
 				.equals(userDir));
+
+		// Regression test for Harmony-382
+        String s = null;
+        f = new File("/abc");
+        File d = new File(s, "/abc");
+        assertEquals("Test3: Created Incorrect File", d.getAbsolutePath(), f
+                .getAbsolutePath());
 	}
 
 	/**



Mime
View raw message