Skip to Main Content

Analytics Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JAVA BEANSHELL EXCEPTION HANDLING

grimrandFeb 19 2013 — edited Feb 20 2013
Hi

still new to ODI

I have created a java beanshell script in ODI which calls a simple java class, cars, then sets the no of seats to a value designed to raise an exception. Exception raised but procedure works OK,

How can I register the fact that it has failed through exception handling? (It is possible that my java exception handling isn't quite right)

The no of seats has no effect on the success/failure of the ODI procedure, but the log shows that the exception is caught !
any assistance gratefully received.


Regards

Terry




cars class: (added to agent start)
====================


public class cars {
private int seats;

public void setSeats (int seats) throws tooManySeatsException {
if (seats) < 100) {
this .seats = seats;
} else {
throw new tooManySeatsException("Too many seats");
}

public int getSeats () {
return this.seats;
}


class tooManySeatsException extends Exception {

public tooManySeatsException (String msg){
super();
}
}
}






Java beanshell procedure in ODI
====================

import cars;

public class carsTest {

public carsTest(){
}

public void init(){
cars c = new cars();

c.setSeats(20);
//c.setseats(200);

}

}


try {
carsTest ct = new carsTest();
ct.init();
} catch (Exception e) {

throw Error (e);
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 20 2013
Added on Feb 19 2013
1 comment
1,076 views