[JBoss JIRA] Commented: (JBPM-826) Incorrect action exception handling
by Alejandro Guizar (JIRA)
[ http://jira.jboss.com/jira/browse/JBPM-826?page=comments#action_12405620 ]
Alejandro Guizar commented on JBPM-826:
---------------------------------------
Checked exceptions cannot be thrown directly to the client unless wrapped in an unchecked exception. Runtime exceptions /could/ be thrown directly; however, even in this case it is useful to have a wrapper exception that immediately tells that the original exception occurred in user code as opposed to jBPM code. In both cases DelegationException is the solution.
The DelegationException message could be set to the original exception's. Apart from that, I do not see how the exception handling is incorrect.
> Incorrect action exception handling
> -----------------------------------
>
> Key: JBPM-826
> URL: http://jira.jboss.com/jira/browse/JBPM-826
> Project: JBoss jBPM
> Issue Type: Bug
> Components: Core Engine
> Affects Versions: jBPM 3.1.3
> Environment: Eclipse + Tomcat + JDK 6.0
> Reporter: Pedro Silva
> Assigned To: Tom Baeyens
> Priority: Critical
>
> If an action in a process definition throws an exception it doesn't correctly reach the client class, e.g. the class doing the signalling.
> Imagine that you have a process definition that in one of the task as an action that opens a file for reading. If the file cannot be found there will be an exception. Te exception is thrown and when it reaches the class, where the code for signalling is, you can't see the exception message. If you try to do, in the catch block, System.err.println(e.getMessage()) the result is null! However if you print System.err.println(e.getCause().getMessage()) the result is the file not found exception.
> This is worst in the case when you caught the exception in the action delegated class and you throw your own exception by explicitly doing: throw new MyException("Some error"); and the message still is null.
> In the case where the exception occurs in another class than the one of the action (if the execute code of the action invokes another class), even the code System.err.println(e.getCause().getMessage()) outputs null.
> The documentattion clearly states in 9.7 Exception Handling:
> "...Uncaught exceptions are thrown to the client (e.g. the client that called the token.signal()) or the exception is caught by a jBPM exception-handler. ..."
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira