RFR: 8339850: Restore the interrupt status in FileSystemPreferences.lockFile()

Daniel Jeliński djelinski at openjdk.org
Fri Sep 27 18:49:38 UTC 2024


On Tue, 10 Sep 2024 16:37:11 GMT, sbgoog <duke at openjdk.org> wrote:

> FIleSystemPreferences.lockFile() catches an InterruptedException and just returns false, forgetting to re-interrupt the current thread. This leaves the caller with no way to observe that the thread was interrupted. This change restores the interrupted status on the current thread before returning.

src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java line 961:

> 959:             } catch(InterruptedException e) {
> 960:                 checkLockFile0ErrorCode(errorCode);
> 961:                 // Don't lose the interrupt unless we throw.

Why should we lose the interrupted status if we throw a SecurityException? It doesn't look right.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/20938#discussion_r1779019030


More information about the core-libs-dev mailing list