Handling Exceptions Inside Oracle BPM Logic

Inside Oracle BPM logic, you can catch exceptions using logic like this:

try {
    MyJavaClass.method(arg1 : arg);
}
catch (NullPointerException e) {
    logMessage("it's a null");
}
catch (Exception e) {
    logMessage("it's an exception");
}
catch (Any e) {
    logMessage("it's an Any");
}

If I'd left off the "NullPointerException" try/catch block, it would have been caught by the "Exception" try/catch block. If I'd left off both of these it would have been caught by the "Any" try/catch block.

If you test the logic from the Workspace you won't see the confusing dialog come up that an uncaught exception occurred. If you instead run your logic from the method editor's debugger, you'll see what appears to be an uncaught exception. If you're running the logic from the method editor's debugger, be sure to click the "Throw" button. If you do this, it will be caught appropriately (in my case in the NullPointerException try/catch block).

Comments

PBL for Exception Handling.

 

Hello Dan -

 

1. Can you please share what will be equivalent PBL for above java code?

2. Or can we use PBL and Java coding on same BPM project?

 

Thanks in advance.

Justin.

PBL for Exception Handling

Hi Justin In PBL this syntax would be as shown below.  You can have a project where some developers use PBL and other use Java syntax, but for consistency pick one or the other.  This will help when you have code walkthoughs and when you have conflicts in your source control system (you compare apples to apples in the compare window

 

do MyJavaClass.method(arg1 : arg)

 

on e as NullPointerException

 

logMessage "it's a null"

 

on e as Exception

 

logMessage "it's an exception"

 

on e as Any

 

logMessage "it's an Any"

 

end

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
 

Avio Consulting, LLC

5600 Tennyson Parkway

Suite 340

Plano, TX  75024

Email: info@avioconsulting.com

Phone: +1 (972) 608-4777

Twitter    Facebook