JDK-8051947 : JNI spec for ExceptionDescribe contradicts hotspot behaviour
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 9
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2014-07-24
  • Updated: 2015-06-02
  • Resolved: 2015-06-02
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9Resolved
Related Reports
Duplicate :  
Relates :  
Description
The original JNI book says that ExceptionDescribe has the side effect of clearing the exception
This text is not present in the on-line JNI specification
However hotspot most certainly does clear it as I see this :-

JNI_ENTRY_NO_PRESERVE(void, jni_ExceptionDescribe(JNIEnv *env))
JNIWrapper("ExceptionDescribe");

HOTSPOT_JNI_EXCEPTIONDESCRIBE_ENTRY(env);

if (thread->has_pending_exception()) {
Handle ex(thread, thread->pending_exception());
thread->clear_pending_exception();
.... 

and a small test progam I wrote confirms that behaviour.
Comments
Merged into 8079466
02-06-2015

Whilst I think the right thing to do here is to make the spec match hotspot's behaviour since its likely been that way for a long time, I also think the spec. should be updated even if its decided that the exception is not cleared - just to be explicit about that Then knowing one way or another, JCK could write a test that would make sure all JVMs were on the same page ..
25-07-2014