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() + "'");
}
}
}