On Thu, 17 Aug 2023 07:54:30 GMT, Matthias Baesken <mbaes...@openjdk.org> wrote:

>> src/java.prefs/unix/classes/java/util/prefs/FileSystemPreferences.java line 
>> 773:
>> 
>>> 771:                String sharingMode = "shared";
>>> 772:                if (!shared) sharingMode = "nonshared";
>>> 773:                throw(new BackingStoreException("Couldn't get file 
>>> lock. errno is " + errCode + " mode is " + sharingMode));
>> 
>> A raw errno is pretty uninformative, except for experts. Can the errno be 
>> translated to a string as well as supplying the errno?
>
> Hi Roger,  sounds like a good idea  to translate it to a more informative 
> string.
> Do you have an  utility function in mind that does this ?

Not trivial in java, there are platform specific native functions to get the 
string for the current errno.
The function definition for `getLastErrorString` is in jni_uti.h, returning a 
java String.

If there are only a couple of errno's that occur for these cases, it might be 
easier to hardwire the translation.
Otherwise, an appropriate native method call and implementation could be added 
to FileSystemPreferences.c for both unix and windows.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15308#discussion_r1297672699

Reply via email to