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

FileHandler may throw NPE if pattern is a simple name and the lock file already exists

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • P4
    • Resolution: Fixed
    • 8u40, 9
    • 9
    • core-libs

    Backports

      Description

        This is a regression introduced by JDK-8048020 - which might happen in the uncommon case where: pattern is a simple name (not a full path), and the .lck file already exists on disk (and hasn't been created by another FileHandler in the same VM).

        In that case, we will check whether we have write permission in the directory in which the lck file is present. The catch is that if the file name is a simple name (not composed), then Path.getParentPath() will return null, and Files.isWritable() will throw NPE.

        Exception in thread "main" java.lang.NullPointerException
        at java.nio.file.Files.provider(Files.java:96)
        at java.nio.file.Files.isAccessible(Files.java:2454)
        at java.nio.file.Files.isWritable(Files.java:2520)
        at java.util.logging.FileHandler.openFiles(FileHandler.java:466)

        Attachments

          Issue Links

            Activity

              People

                dfuchs Daniel Fuchs
                dfuchs Daniel Fuchs
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: