Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8037945

Paths.get("").normalize() throws ArrayIndexOutOfBoundsException

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 7u51
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b08
    • CPU:
      x86_64
    • OS:
      linux
    • Verification:
      Verified

      Backports

        Description

        FULL PRODUCT VERSION :
        All of JDK 8, JDK7 u51 and OpenJDK 7u51 have the problem

        ADDITIONAL OS VERSION INFORMATION :
        Ubuntu Linux 13.10, x86-64

        A DESCRIPTION OF THE PROBLEM :
        fge@alustriel:/tmp$ cat Foo.java
        import java.nio.file.Paths;


        public class Foo
        {
            public static void main(final String... args)
            {
                System.out.printf("'%s'\n", Paths.get("").normalize());
                System.exit(0);
            }
        }
        fge@alustriel:/tmp$ javac Foo.java
        fge@alustriel:/tmp$ java Foo
        Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
        at sun.nio.fs.UnixPath.normalize(UnixPath.java:508)
        at Foo.main(Foo.java:8)


        REGRESSION. Last worked in version 6u45

        ADDITIONAL REGRESSION INFORMATION:
        Does NOT happen on Windows systems. I don't have other Unix systems than Linux to test on.

        I only discovered the bug recently... I set the "prior working release" to the latest JDK 6 version since it didn't have Path...

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        See description...

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Return an empty path
        ACTUAL -
        See description...

        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        See description...

        REPRODUCIBILITY :
        This bug can be reproduced always.

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


        public class Foo
        {
            public static void main(final String... args)
            {
                System.out.printf("'%s'\n", Paths.get("").normalize());
                System.exit(0);
            }
        }

        ---------- END SOURCE ----------

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                alanb Alan Bateman
                Reporter:
                webbuggrp Webbug Group
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: