RFR: 8048020 - Regression on java.util.logging.FileHandler (original) (raw)

Jason Mehrens jason_mehrens at hotmail.com
Wed Jun 25 15:27:30 UTC 2014


Alan,

Catching OverlappingFileLockException is usually a sign of a mis-use. Can you summarize how this comes about (given the locking on "locks").

Malicious intent or ignorant mis-use by code outside of the FileHandler can turn the FileHandler into a victim of that misuse.

=======

public static void main(String[] args) throws Exception { Path p = Files.createTempFile("test", "test"); try (FileChannel pathogen = FileChannel.open(p, CREATE, WRITE)) { FileLock lck = pathogen.lock(); System.out.println(lck); try (FileChannel fileHandler = FileChannel.open(p, WRITE, APPEND)) { FileLock fhl = fileHandler.lock(); System.out.println(fhl); } } finally { Files.deleteIfExists(p); } }

=========

sun.nio.ch.FileLockImpl[0:9223372036854775807 exclusive valid] Exception in thread "main" java.nio.channels.OverlappingFileLockException

=================

Jason



More information about the core-libs-dev mailing list