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

(fs spec) Package description could be clearer on the cases where NPE is thrown

    XMLWordPrintable

Details

    • b39
    • Verified

    Backports

      Description

        Unexpected NPE is thrown in cases when null passed as element of options array, for example
        Files.newBufferedWriter(myPath, new OpenOption[]{null})
        Files.newBufferedWriter(myPath, new OpenOption[]{null, StandardOpenOption.CREATE})

        java.nio.file package's spec (http://jre.us.oracle.com/java/re/jdk/9/promoted/all/b35/docs/api/java/nio/file/package-summary.html
        ) says that


        "Unless otherwise noted, passing a null argument to a constructor or method of any class or interface in this package will cause a NullPointerException to be thrown.
        Additionally, invoking a method with a collection containing a null element will cause a NullPointerException, unless otherwise specified."

        As we think it would be great to specify that NPE will be thrown in case of null-elements in array too.


        Tested with JDK9b35
        Failed JCK tests is under development

        Attachments

          Issue Links

            Activity

              People

                alanb Alan Bateman
                asolodkaya Anastasiya Solodkaya (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: