harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r513774 - in /harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/io/File.java test/java/tests/api/java/io/FileTest.java
Date Fri, 02 Mar 2007 14:12:27 GMT
Author: ayza
Date: Fri Mar  2 06:12:27 2007
New Revision: 513774

URL: http://svn.apache.org/viewvc?view=rev&rev=513774
Log:
Applying patch from HARMONY-3207 ([classlib][io] File.toURI does not add a slash at the end
of URI for a directory pathname in some cases.)

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

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java?view=diff&rev=513774&r1=513773&r2=513774
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java Fri Mar 
2 06:12:27 2007
@@ -1295,8 +1295,10 @@
     }
 
     private String getAbsoluteName() {
-        String name = getAbsolutePath();
-        if (isDirectory() && name.charAt(name.length() - 1) != separatorChar) {
+        File f = getAbsoluteFile();
+        String name = f.getPath();
+
+        if (f.isDirectory() && name.charAt(name.length() - 1) != separatorChar) {
             // Directories must end with a slash
             name = new StringBuilder(name.length() + 1).append(name)
                     .append('/').toString();

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/FileTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/FileTest.java?view=diff&rev=513774&r1=513773&r2=513774
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/FileTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/io/FileTest.java
Fri Mar  2 06:12:27 2007
@@ -2091,6 +2091,11 @@
 			assertTrue("Test 2B: Incorrect URI Returned.", uri.equals(new URI(
 					"file", null, newURIPath, null, null)));
 
+			// Regression test for HARMONY-3207
+			dir = new File(""); // current directory
+			uri = dir.toURI();
+			assertTrue("Test current dir: URI does not end with slash.",
+					uri.toString().endsWith("/"));
 		} catch (URISyntaxException e1) {
 			fail("Unexpected URISyntaxException: " + e1);
 		}
@@ -2128,6 +2133,12 @@
 				newURL = "file:/" + newURL;
 			assertTrue("Test 2: Incorrect URL Returned.", newURL.equals(f
 					.toURL().toString()));
+
+			// Regression test for HARMONY-3207
+			dir = new File(""); // current directory
+			newDirURL = dir.toURL().toString();
+			assertTrue("Test current dir: URL does not end with slash.",
+					newDirURL.endsWith("/"));
 		} catch (java.net.MalformedURLException e) {
 			fail(
 					"Unexpected java.net.MalformedURLException During Test.");



Mime
View raw message