JDK-8043208 : AIOOB in UnixPath.normalize
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 8
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2014-05-15
  • Updated: 2014-05-15
  • Resolved: 2014-05-15
Related Reports
Duplicate :  
Description
Attempting to normalize an empty path causes an exception

/opt/jdk/1.8.0/bin/java -cp play/classes/ P  ''
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
	at sun.nio.fs.UnixPath.normalize(UnixPath.java:508)
	at P.main(P.java:9)

Here is the demo code:
import java.nio.file.*;

class P {
    public static void main(String... args) {
	for (String arg: args) {
            System.out.println("'" + arg + "'"
		+ " '" + Paths.get(arg) + "'"
		+ " '" + Paths.get(arg).toAbsolutePath() + "'"
		+ " '" + Paths.get(arg).normalize() + "'");
        }
    }
}

Comments
Confirmed as dup of JDK-8037945.
15-05-2014

This may be of a dup of JDK-8037945, fixed in 9 and 8u20.
15-05-2014