On Fri, 1 Sep 2023 12:36:28 GMT, Matthias Baesken <mbaes...@openjdk.org> wrote:

>> We run into some BackingStoreException: Couldn't get file lock. e.g. here :
>> 
>> [JShell] Exception in thread "main" java.lang.IllegalStateException: 
>> java.util.prefs.BackingStoreException: Couldn't get file lock.
>> [JShell] at 
>> jdk.jshell/jdk.internal.jshell.tool.JShellToolBuilder$PreferencesStorage.flush(JShellToolBuilder.java:313)
>> [JShell] at 
>> jdk.jshell/jdk.internal.jshell.tool.JShellTool$ReplayableHistory.storeHistory(JShellTool.java:692)
>> [JShell] at 
>> jdk.jshell/jdk.internal.jshell.tool.JShellTool.start(JShellTool.java:1008)
>> [JShell] at 
>> jdk.jshell/jdk.internal.jshell.tool.JShellToolBuilder.start(JShellToolBuilder.java:261)
>> [JShell] at 
>> jdk.jshell/jdk.internal.jshell.tool.JShellToolProvider.main(JShellToolProvider.java:120)
>> [JShell] Caused by: java.util.prefs.BackingStoreException: Couldn't get file 
>> lock.
>> [JShell] at 
>> java.prefs/java.util.prefs.FileSystemPreferences.sync(FileSystemPreferences.java:769)
>> [JShell] at 
>> java.prefs/java.util.prefs.FileSystemPreferences.flush(FileSystemPreferences.java:864)
>> [JShell] at 
>> jdk.jshell/jdk.internal.jshell.tool.JShellToolBuilder$PreferencesStorage.flush(JShellToolBuilder.java:311)
>> [JShell] ... 4 more
>> 
>> The BackingStoreException should be enhanced e.g. by adding the 
>> errno/errorCode that is already available in the coding
>
> Matthias Baesken has updated the pull request incrementally with one 
> additional commit since the last revision:
> 
>   add for some errnos also the string

Nice improvement! Please see my minor comments.

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

> 721:         }
> 722:         return "";
> 723:     }

Would be a nice use case of switch expressions. But, I'm ok with it.

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

> 729:             if (errCode != 0) {
> 730:                 String errStr = getErrorString(errCode);
> 731:                 if (! errStr.equals("")) errStr = " (" + errStr + ")";

Coding style: whitespace after '!'

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

> 730:                 String errStr = getErrorString(errCode);
> 731:                 if (! errStr.equals("")) errStr = " (" + errStr + ")";
> 732:                 throw(new BackingStoreException("Couldn't get file lock. 
> errno is " + errCode + errStr));

Strange coding style (also in the original code). I'd use "throw new ...".

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

> 796:                if (!shared) sharingMode = "nonshared";
> 797:                String errStr = getErrorString(errCode);
> 798:                if (! errStr.equals("")) errStr = " (" + errStr + ")";

as above

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

> 797:                String errStr = getErrorString(errCode);
> 798:                if (! errStr.equals("")) errStr = " (" + errStr + ")";
> 799:                throw(new BackingStoreException("Couldn't get file lock. 
> errno is " + errCode + errStr + " mode is " + sharingMode));

as above

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

Marked as reviewed by mdoerr (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/15308#pullrequestreview-1606876656
PR Review Comment: https://git.openjdk.org/jdk/pull/15308#discussion_r1312979770
PR Review Comment: https://git.openjdk.org/jdk/pull/15308#discussion_r1312980202
PR Review Comment: https://git.openjdk.org/jdk/pull/15308#discussion_r1312982035
PR Review Comment: https://git.openjdk.org/jdk/pull/15308#discussion_r1312982899
PR Review Comment: https://git.openjdk.org/jdk/pull/15308#discussion_r1312983075

Reply via email to