Hello,

I don’t really understand this discussion,is the normal IO and NIO api not already interpreting error codes? (I am quite sure I often see nationalized error messages in exceptions).


I think switching to non-native implementation will not only benefit the error messages.

Gruss
Bernd
--
http://bernd.eckenfels.net
 

Von: core-libs-dev <core-libs-dev-r...@openjdk.org> im Auftrag von Matthias Baesken <mbaes...@openjdk.org>
Gesendet: Donnerstag, August 24, 2023 1:47 PM
An: core-libs-dev@openjdk.org <core-libs-dev@openjdk.org>
Betreff: Re: RFR: JDK-8314272: Improve java.util.prefs.BackingStoreException: Couldn't get file lock.
 
On Wed, 16 Aug 2023 13:36:38 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.JShellToolProvidermain(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

Btw printing just the errno - integer code looks not so nice first but on a lot of distros there are already OS tools that convert it for you so it is easy to get the string from the int value.


:~$ apt install moreutils

:~$ errno 11
EAGAIN 11 Resource temporarily unavailable

Having said that , I could still hardwire a couple of important errnos on Java level like Roger suggested
> If there are only a couple of errno's that occur for these cases, it might be easier to hardwire the translation.

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

PR Comment: https://git.openjdk.org/jdk/pull/15308#issuecomment-1691522291

Reply via email to