In a well-designed process, exceptions and faults are usually
handled by fault handlers. You can retrieve information about the
exception or fault that occurred for an invoke activity from the activity
instance.
About this task
If an activity causes a fault to occur, the fault type determines
the actions that you can take to repair the activity.
Procedure
- List the human task activities that are in a stopped state.
FilterOptions fo = new FilterOptions();
fo.setSelectedAttributes("AIID");
fo.setQueryCondition("STATE=STATE_STOPPED AND KIND=KIND_INVOKE");
EntityResultSet result = process.queryEntities("ACTIVITY", fo, null, null);
This action returns
a query result set that contains stopped invoke activities.
- Read the name of the fault.
if (result.getEntities().size() > 0)
{
Entity entity = (Entity) result.getEntities().get(0);
AIID aiid = (AIID) entity.getAttributeValue("AIID");
ActivityInstanceData activity = process.getActivityInstance(aiid);
ProcessException excp = activity.getUnhandledException();
if ( excp instanceof ApplicationFaultException )
{
ApplicationFaultException fault = (ApplicationFaultException)excp;
String faultName = fault.getFaultName();
}
}