RFR: JDK-8314272: Improve java.util.prefs.BackingStoreException: Couldn't get file lock.
Roger Riggs
rriggs at openjdk.org
Thu Aug 17 19:53:30 UTC 2023
On Thu, 17 Aug 2023 07:54:30 GMT, Matthias Baesken <mbaesken at 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
More information about the core-libs-dev
mailing list