Index: src/main/java/java/io/File.java =================================================================== --- src/main/java/java/io/File.java (revision 509242) +++ src/main/java/java/io/File.java (working copy) @@ -1295,8 +1295,9 @@ } 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(); Index: src/test/java/tests/api/java/io/FileTest.java =================================================================== --- src/test/java/tests/api/java/io/FileTest.java (revision 509242) +++ src/test/java/tests/api/java/io/FileTest.java (working copy) @@ -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.");