cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot Access Field: getChain for Application Exception

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Devesh,

Must have been too tired when coded this, ofcourse, how can I miss parenthesis on a method?

Anyway, thanks a mill.

Answers (0)