Issue 54482 - jurt PipeConnection.c Java exception handling
Summary: jurt PipeConnection.c Java exception handling
Status: ACCEPTED
Alias: None
Product: udk
Classification: Code
Component: code (show other issues)
Version: 680m124
Hardware: All All
: P4 Trivial (vote)
Target Milestone: AOO PleaseHelp
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-12 09:51 UTC by Stephan Bergmann
Modified: 2017-05-20 11:31 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Stephan Bergmann 2005-09-12 09:51:19 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);
  }
Comment 1 Stephan Bergmann 2005-09-12 09:52:31 UTC
.
Comment 2 Marcus 2017-05-20 11:31:40 UTC
Reset assigne to the default "issues@openoffice.apache.org".