diff --git a/jdk/src/solaris/classes/sun/nio/fs/UnixPath.java b/jdk/src/solaris/classes/sun/nio/fs/UnixPath.java index fe430cc5ee6..9f45afdab48 100644 --- a/jdk/src/solaris/classes/sun/nio/fs/UnixPath.java +++ b/jdk/src/solaris/classes/sun/nio/fs/UnixPath.java @@ -482,7 +482,7 @@ class UnixPath @Override public Path normalize() { final int count = getNameCount(); - if (count == 0) + if (count == 0 || isEmpty()) return this; boolean[] ignore = new boolean[count]; // true => ignore name diff --git a/jdk/test/java/nio/file/Path/PathOps.java b/jdk/test/java/nio/file/Path/PathOps.java index 865581c9273..f237f68ccaa 100644 --- a/jdk/test/java/nio/file/Path/PathOps.java +++ b/jdk/test/java/nio/file/Path/PathOps.java @@ -22,7 +22,7 @@ */ /* @test - * @bug 4313887 6838333 6925932 7006126 + * @bug 4313887 6838333 6925932 7006126 8037945 * @summary Unit test for java.nio.file.Path path operations */ @@ -899,6 +899,8 @@ public class PathOps { .normalize("foo"); test("/foo") .normalize("/foo"); + test("") + .normalize(""); test(".") .normalize(""); test("..")