-
Bug
-
Resolution: Done
-
Major
-
jBPM 3.1.0
-
None
If you throw an exception within a <script> and use an <exception-handler> to deal with the exception, the handler is only found if you didn't specify the "exception-class" attribute. It looks like the bsh code is wrapping any exception in a JbpmException, so you'll never find a matching handler. There really isn't a good workaround for this if you want exception-class-specific handlers, other than to not use <script> in the first place.
This is really easy to reproduce. For the code below or anything like it you'll find that your action is never matched to the exception so long as there is an "exception-class" attribute.
<process-definition name='exception-handler-test' xmlns='urn:jbpm.org:jpdl-3.1'>
<action name='my-action' class='pkg.MyExceptionAction'/>
<exception-handler exception-class='java.lang.IllegalStateException'>
<action ref-name='my-action'/>
</exception-handler>
<start-state>
<transition to='end'>
<script><expression>throw new IllegalStateException("my exception");</expression> </script>
</transition>
</start-state>
<end-state name='end'/>
</process-definition>