RFR: 8257858: [macOS]: Remove JNF dependency from libosxsecurity/KeystoreImpl.m [v2]

Phil Race prr at openjdk.java.net
Fri Jan 29 22:08:40 UTC 2021

On Fri, 29 Jan 2021 21:47:32 GMT, Weijun Wang <weijun at openjdk.org> wrote:

>> src/java.base/macosx/native/libosxsecurity/KeystoreImpl.m line 619:
>>> 617:             (*env)->ReleaseCharArrayElements(env, passwordObj, passwordChars,
>>> 618:                 JNI_ABORT);
>>> 619:         }
>> Although you have it in the later code, here you are missing
>>  @catch (NSException *e) { 
>>      NSLog(@"%@", [e callStackSymbols]); 
>>  }
> Will add.
> BTW, will these be shown on stdout or stderr? If so, is this a good idea?

should be stderr. Whether to log is up to you. You could wrap it in something that checks for a debug build.
The idea is that if this ever happens there is a serious problem. NSException is only thrown (by the OS frameworks) in supposedly fatal scenarios.

>> src/java.security.jgss/macosx/native/libosxkrb5/SCDynamicStoreConfig.m line 57:
>>> 55:         }
>>> 56:     }
>>> 57:     (*localVM)->DetachCurrentThread(localVM);
>> I think you only want to detach if you actually attached ! you don't want to be detaching VM threads.
> So I should remember how env was retrieved and only detach when it's from `AttachCurrentThreadAsDaemon`? In fact, in my test the plain `GetEnv` has never succeeded and it was always attached.

Yes that is the idea. BTW which thread was it attached to in what you saw ?


PR: https://git.openjdk.java.net/jdk/pull/1845

More information about the core-libs-dev mailing list