Catching evalError?
Hi (again),
I know this might be a stupid question but I'm having trouble catching an EvalError in a Java script.
Specifically, I'm getting the following error:
An error occurred while processing the script: DP Script - Check Assignment_Appn
The error message was: class bsh.EvalError (line 132): if ( sutil .isNullOrEmptyString ( Assignee_Name_AppnPage_STR ) == false && sutil .isNullOrEmptyString ( Assignee_Address_AppnPage_STR ) == false && Assignee_Info_Found_BOOL == false && ( ! ( Assignee_Name_AppnPage_STR .equals ( "N/A" ) ) ) && ( ! ( Assignee_Address_AppnPage_STR .equals ( "N/A" ) ) ) && Assignee_Info_Found_BOOL == false ) { -- Typed variable: Assignee_Address_AppnPage_ARY: Can't assign boolean to java.util.ArrayList
The error message was: class bsh.EvalError (line 132): if ( sutil .isNullOrEmptyString ( Assignee_Name_AppnPage_STR ) == false && sutil .isNullOrEmptyString ( Assignee_Address_AppnPage_STR ) == false && Assignee_Info_Found_BOOL == false && ( ! ( Assignee_Name_AppnPage_STR .equals ( "N/A" ) ) ) && ( ! ( Assignee_Address_AppnPage_STR .equals ( "N/A" ) ) ) && Assignee_Info_Found_BOOL == false ) { -- Typed variable: Assignee_Address_AppnPage_ARY: Can't assign boolean to java.util.ArrayList
...which I think is related to the following code:
if (US_State_Found1_BOOL==true || Cdn_Province_Found2_BOOL==true)
{
Assignee_Address_AppnPage_STR = (sutil.nullToEmptyString(session.getVariable("US_APPN_ASSIGNEE_STATE"))).trim();
try
{
session.logInfo("--- Check Assignees script: adding " + Assignee_Address_AppnPage_STR + " to array list ---"); //for testing
Assignee_Address_AppnPage_ARY.add(Assignee_Address_AppnPage_STR);
} catch (EvalError e) {
//this should catch an EvalError error
session.logError("--- Check Assignees script: assignee string " + Assignee_Address_AppnPage_STR + " for application " + session.getVariable("US_APPN_PUB_NO") + " couldn't be parsed ---"); //for testing
}
{
Assignee_Address_AppnPage_STR = (sutil.nullToEmptyString(session.getVariable("US_APPN_ASSIGNEE_STATE"))).trim();
try
{
session.logInfo("--- Check Assignees script: adding " + Assignee_Address_AppnPage_STR + " to array list ---"); //for testing
Assignee_Address_AppnPage_ARY.add(Assignee_Address_AppnPage_STR);
} catch (EvalError e) {
//this should catch an EvalError error
session.logError("--- Check Assignees script: assignee string " + Assignee_Address_AppnPage_STR + " for application " + session.getVariable("US_APPN_PUB_NO") + " couldn't be parsed ---"); //for testing
}
The problem is that my catch block doesn't seem to be executing properly as I keep getting the error message above and not the one in the catch block. Any ideas?
Thanks,
Justin
I would need to more more
I would need to more more about your script's context to be much help, but I would:
if (US_State_Found1_BOOL!=null && US_State_Found1_BOOL)
{
session.log("US_State_Found1_BOOL is true");
addToArray = true
}
else if (Cdn_Province_Found2_BOOL !=null && Cdn_Province_Found2_BOOL)
{
session.log("Cdn_Province_Found2_BOOL is true");
addToArray = true
}
if (addToArray)
{
Assignee_Address_AppnPage_STR = (session.getv("US_APPN_ASSIGNEE_STATE"));
if (Assignee_Address_AppnPage_STR = null)
Assignee_Address_AppnPage_STR = "";
else
Assignee_Address_AppnPage_STR = Assignee_Address_AppnPage_STR.trim();
session.logInfo("--- Check Assignees script: adding " + Assignee_Address_AppnPage_STR + " to array list ---"); //for testing
Assignee_Address_AppnPage_ARY.add(Assignee_Address_AppnPage_STR);
}
else
{
session.log("Expected value was not set");
}
So I could see better what is/isn't set.
Thanks - this got me through the problem
Hi Jason,
Thanks for suggesting this code - I implemented it and was able to use it to bypass the uncatchable EvalError. (yay!)
Take care and have a great day!
Justin