Apache OpenOffice (AOO) Bugzilla – Issue 54482
jurt PipeConnection.c Java exception handling
Last modified: 2017-05-20 11:31:40 UTC
In jurt/source/pipe/com_sun_star_lib_connections_pipe_PipeConnection.c, handling of Java exceptions is broken. For example, ThrowException and MonitorExit are called without a previous call to ExceptionClear, and state ACQUIRED is not catered for in the error-handling code of Java_com_sun_star_lib_connections_pipe_PipeConnection_readJNI. The following is some prototypical code to use: void native_fn(jobect o) { if (env->MonitorEnter(o) < 0) return; // ... if (env->FindClass("...") == 0) { // Some Java exception occurred while // within the monitor, exit the monitor and // return with a Java exception pending: jthrowable e = env->ExceptionOccurred(); assert e != 0; env->ExceptionClear(); if (env->MonitorExit(o) == 0) { env->Throw(e); // even if Throw returns < 0, // it is guaranteed that *some* // exception is being thrown, // right? } return; } // ... env->MonitorExit(o); }
.
Reset assigne to the default "issues@openoffice.apache.org".