cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

The community will undergo maintenance on October 16th at 10:00 PM PDT and will be unavailable for up to one hour.

Java exception handling in ACL

jonathan.reeve
1-Newbie

Java exception handling in ACL

If I call some Java code from ACL and the Java code throws an exception, I see a message in the status bar, but the ACL script continues.

I tried this:
if ( 0 != catch("java_instance( $myObj, 'myMethod' )") ) {
response( "Barfed." )
}
The message wasn't displayed.

Is there another way to handle the exception?


Jonathan Reeve
Practical Law Company
19 Hatfields
London SE1 8DJ
T +44 (0)20 3423 6586
E jonathan.reeve@practicallaw.com
W http://www.practicallaw.com/

2 REPLIES 2

The best design for calling Java from ACL is to create a class with a bunch of static methods meant to be the interface to ACL, and call using java_static(). It's the easiest way to limit the risk of memory leaks in the passthrough (if you don't call java_delete() on the java instances used in your ACL code, their reference counts never get decremented, and the JVM's garbage collector never picks them up).

So your best bet would be to write a static method that calls your instance method and handles any exceptions that come up.

Chris

You can handle the exception in the java code and call Acl.func("response","error") in the java code to response the error message

Announcements

Top Tags