harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From qi...@apache.org
Subject svn commit: r691095 - in /harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/io/File.java test/api/windows/org/apache/harmony/luni/tests/java/io/WinFileTest.java
Date Tue, 02 Sep 2008 02:31:15 GMT
Author: qiuxx
Date: Mon Sep  1 19:31:14 2008
New Revision: 691095

URL: http://svn.apache.org/viewvc?rev=691095&view=rev
Log:
Apply for HARMONY-5961 with minor modification, ([classlib][luni]File.toURI() returns incorrect
UNC uri)

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/io/File.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/api/windows/org/apache/harmony/luni/tests/java/io/WinFileTest.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?rev=691095&r1=691094&r2=691095&view=diff
==============================================================================
--- 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 Mon Sep 
1 19:31:14 2008
@@ -1279,7 +1279,7 @@
                         name.length() + 1).append('/').append(name).toString(),
                         null, null);
             } else if (name.startsWith("//")) {
-                return new URI("file", name, null); // UNC path
+                return new URI("file", "", name, null); // UNC path
             }
             return new URI("file", null, name, null, null);
         } catch (URISyntaxException e) {

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/api/windows/org/apache/harmony/luni/tests/java/io/WinFileTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/api/windows/org/apache/harmony/luni/tests/java/io/WinFileTest.java?rev=691095&r1=691094&r2=691095&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/api/windows/org/apache/harmony/luni/tests/java/io/WinFileTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/api/windows/org/apache/harmony/luni/tests/java/io/WinFileTest.java
Mon Sep  1 19:31:14 2008
@@ -20,6 +20,7 @@
 import java.io.IOException;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
+import java.net.URI;
 
 import tests.support.resource.Support_Resources;
 
@@ -123,4 +124,13 @@
         assertEquals("Invalid content was red", CONTENT, wasRed);
     }
 
+    /**
+     * @test java.io.File#toURI()
+     */
+    public void test_toURI_UNC() throws Exception {
+        File f = new File("\\\\unchost\\[dir]\\file.txt");
+        assertNotNull(f.toURI());
+        assertEquals("incorrect URI for UNC path: " + f.toURI(), f.toURI(),
+                new URI("file:////unchost/%5Bdir%5D/file.txt"));
+    }
 }



Mime
View raw message