Paths.get("").normalize() throws AIOOBE on linux

Seán Coffey sean.coffey at oracle.com
Tue May 27 18:00:11 UTC 2014


I'll take an action item to get this into 7u80. Thanks for brining it up!

regards,
Sean.

On 27/05/2014 17:37, Alan Bateman wrote:
> On 13/02/2013 03:24, Michael Hixson wrote:
>> Hello,
>>
>> I notice that on Linux, the following program throws an exception:
>>
>>    import java.nio.file.Paths;
>>    public class HelloWorld {
>>      public static void main(String[] args) {
>>        Paths.get("").normalize();
>>      }
>>    }
>>
>>    Exception in thread "main" 
>> java.lang.ArrayIndexOutOfBoundsException: 0
>>            at sun.nio.fs.UnixPath.normalize(UnixPath.java:508)
>>            at HelloWorld.main(HelloWorld.java:4)
>>
>> Meanwhile on Windows, no exception is thrown.  The following code 
>> prints "true":
>>
>>    Path a = Paths.get("");
>>    Path b = a.normalize();
>>    System.out.println(a.equals(b));
>>
>> Is this difference in behavior expected?
>>
>> I'm using 1.7u13 in both places.
>>
>> -Michael
> This mail just arrived but strangely has a timestamp of 2013.
>
> In any case, it is bug JDK-8037945, fixed in 8u20 and 9. It would be 
> good to bring up on jdk7u-dev to get it fixed there.
>
> -Alan.



More information about the nio-dev mailing list