8031586: Check jdk/src/*/native/com/sun/security/auth/module for pending JNI exceptions

Alan Bateman Alan.Bateman at oracle.com
Tue Feb 4 15:02:26 UTC 2014


The native methods for the JDK-specific API to JAAS don't handle handle 
errors and JNI exceptions everywhere. I'd like to fix some of these with 
the following patch:

http://cr.openjdk.java.net/~alanb/8031586/webrev/

A couple of things to note:

- The existing code throws IllegalArgumentException for cases where 
GetFieldID fails. I've cleaned this up a bit but it might be simpler to 
just get rid of this and let the NoSuchFieldError or other error be 
thrown, any opinions? I should add that at least in 
SolarisSystem.getSolarisInfo then the exception messages weren't 
actually useful because they are all the same. I can only assume that 
the original author wanted a useful exception thrown when the java and 
native code is out of sync.

- In NTSystem.getCurrent it requires a lot of work to set systemError to 
true when there is an error. I decided the simplest thing here is to 
just removing the not-very-useful message printed to stdout.

- As the JAAS library is not linked to libjava then it means we can't 
use the JNU_* functions defined in jni_util.c. We deliberately removed 
this dependency some time ago as part of our modularity efforts.

-Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/security-dev/attachments/20140204/2253425e/attachment.htm>


More information about the security-dev mailing list