in src/main/java/org/apache/commons/scxml2/env/SimpleErrorReporter.java [78:141]
public void onError(final String errorCode, final String errDetail,
final Object errCtx) {
//Note: the if-then-else below is based on the actual usage
// (codebase search), it has to be kept up-to-date as the code changes
final String errCode = errorCode.intern();
final StringBuilder msg = new StringBuilder();
msg.append(errCode).append(" (");
msg.append(errDetail).append("): ");
if (errCode == ErrorConstants.NO_INITIAL) {
if (errCtx instanceof SCXML) {
//determineInitialStates
msg.append("<SCXML>");
} else if (errCtx instanceof State) {
//determineInitialStates
//determineTargetStates
msg.append("State ").append(LogUtils.getTTPath((State) errCtx));
}
} else if (errCode == ErrorConstants.UNKNOWN_ACTION) {
//executeActionList
msg.append("Action: ").append(errCtx.getClass().getName());
} else if (errCode == ErrorConstants.ILLEGAL_CONFIG) {
//isLegalConfig
if (errCtx instanceof Map.Entry) { //unchecked cast below
final Map.Entry<EnterableState, Set<EnterableState>> badConfigMap =
(Map.Entry<EnterableState, Set<EnterableState>>) errCtx;
final EnterableState es = badConfigMap.getKey();
final Set<EnterableState> vals = badConfigMap.getValue();
msg.append(LogUtils.getTTPath(es)).append(" : [");
for (final Iterator<EnterableState> i = vals.iterator(); i.hasNext();) {
final EnterableState ex = i.next();
msg.append(LogUtils.getTTPath(ex));
if (i.hasNext()) { // reason for iterator usage
msg.append(", ");
}
}
msg.append(']');
} else if (errCtx instanceof Set) { //unchecked cast below
final Set<EnterableState> vals = (Set<EnterableState>) errCtx;
msg.append("<SCXML> : [");
for (final Iterator<EnterableState> i = vals.iterator(); i.hasNext();) {
final EnterableState ex = i.next();
msg.append(LogUtils.getTTPath(ex));
if (i.hasNext()) {
msg.append(", ");
}
}
msg.append(']');
}
} else if (errCode == ErrorConstants.EXPRESSION_ERROR) {
if (errCtx instanceof Executable) {
final TransitionTarget parent = ((Executable) errCtx).getParent();
msg.append("Expression error inside ").append(LogUtils.getTTPath(parent));
}
else if (errCtx instanceof Data) {
// Data expression error
msg.append("Expression error for data element with id ").append(((Data) errCtx).getId());
}
else if (errCtx instanceof SCXML) {
// Global Script
msg.append("Expression error inside the global script");
}
}
handleErrorMessage(errorCode, errDetail, errCtx, msg);
}