on 06-18-2012 12:43 PM
Hi,
I am trying to validate a collection field in Beanshell but keep getting the following error while doing the validation.
Cannot access field: getChain, on object: com.frictionless.api.common.exception.ApplicationException
My code is as follows:
// Create Application Exception to hold exceptions
ApplicationException ae = new ApplicationException(session);
logMessage = Logger.createLogMessage(session);
logMessage.setLogMessage("Executing Distribution DIST_VALUE validation");
Logger.info(logMessage);
distrColl = doc.getExtensionCollection("DistributionColl");
valOfAgr = doc.getExtensionField("ValueOfAgrmtExt2").get();
logMessage.setLogMessage("Value Of Agreement: "+valOfAgr);
Logger.info(logMessage);
itr = distrColl.iterator();
logMessage.setLogMessage("itr hasNext() = "+itr.hasNext());
Logger.info(logMessage);
while(itr.hasNext()){
i = itr.next();
item = i.get("DIST_VALUE");
logMessage.setLogMessage("item Value: "+item);
Logger.info(logMessage);
if (!valOfAgr.equals(item)) {
ae.chainAtEnd(i.createApplicationException("DIST_VALUE","target_value_error"));
logMessage.setLogMessage("DIST_VALUE and ValOfAgr not equal");
Logger.info(logMessage);
}
}
if (ae.getChain != null){
ae.chainAtEnd(doc.createApplicationException("DistributionColl", "target_value_error"));
throw ae.getChain();
}
Your assistance will be highly appreciated.
Thanks
Tebogo
Hi Tebogo,
Its a very small mistake on you part, probably a typo.
Replace
if (ae.getChain != null)
with
if (ae.getChain() != null)
Notice the parenthesis. This should solve your problem.
Thanks
Devesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.