Bug on at least Linux, Mac OS X with Paths.get("").normalize()

Francis Galiegue fgaliegue at gmail.com
Sat Mar 22 00:56:42 UTC 2014


Hello,

I am currently writing a FileSystem implementation for FTP and while
testing the nooks and crannies of the API, I stumbled upon this bug.

This very simple main():

----
import java.nio.file.Paths;

public class Foo
{
    public static void main(final String... args)
    {
        System.out.println(Paths.get("").normalize());
    }
}
----

results in:

----
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
    at sun.nio.fs.UnixPath.normalize(UnixPath.java:508)
    at Foo.main(Foo.java:7)
----

Confirmed to "work" on Mac OS X; what is more, this affects both Java
7 and Java 8.

Regards,
-- 
Francis Galiegue, fgaliegue at gmail.com
JSON Schema in Java: http://json-schema-validator.herokuapp.com


More information about the nio-dev mailing list