Uploaded image for project: 'jBPM'
  1. jBPM
  2. JBPM-637

exception-handler can't use exception-class attribute with script-thrown exceptions

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • jBPM 3.1.2
    • jBPM 3.1.0
    • Runtime Engine
    • 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>

            tom.baeyens Tom Baeyens (Inactive)
            reidmp_jira Reid Pinchback (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: