RFR: 8059269 - FileHandler may throw NPE if pattern is a simple name and the lock file already exists
daniel.fuchs at oracle.com
Fri Sep 26 18:33:44 UTC 2014
Please find below a patch for 
8059269: FileHandler may throw NPE if pattern is a simple name and
the lock file already exists
The webrev is here:
This is a regression which I unfortunately introduced with my
patch for JDK-8048020 - and which I stumbled upon while writing
another test (which should have failed but didn't).
It happens in the uncommon case where:
1. a lock file for the given name pattern already exists, and
hasn't been created by another FileHandler in the same VM, and
2. the file name pattern is a simple file name (not composite - that
is, it doesn't contain any file separator).
In that case, FileHandler will attempt to reuse the existing
lock file, but it will first check whether the directory
in which the lock file should be created is writable, which it does
by calling Files.isWritable(lockFilePath.getParent()). We want to
check whether the directory is writable because there's no point
in locking the existing lock file if we can't create
any new file in that directory.
Unfortunately, lockFilePath.getParent() returns null if the file name
is simple, and a NullPointerException is thrown.
More information about the core-libs-dev