use of org.kie.dmn.core.util.Msg in project drools by kiegroup.
the class DMNFEELHelper method processEvents.
public void processEvents(DMNModelImpl model, DMNElement element, Msg.Message msg, Object... msgParams) {
Queue<FEELEvent> feelEvents = listener.getFeelEvents();
while (!feelEvents.isEmpty()) {
FEELEvent event = feelEvents.remove();
if (!isDuplicateEvent(model, msg, element)) {
if (event instanceof SyntaxErrorEvent || event.getSeverity() == FEELEvent.Severity.ERROR) {
if (msg instanceof Msg.Message2) {
MsgUtil.reportMessage(logger, DMNMessage.Severity.ERROR, element, model, null, event, (Msg.Message2) msg, msgParams[0], msgParams[1]);
} else if (msg instanceof Msg.Message3) {
Object message3 = null;
if (msgParams.length == 3) {
message3 = msgParams[2];
} else {
// wrap the originating FEEL error as the last message
message3 = event.getMessage();
}
MsgUtil.reportMessage(logger, DMNMessage.Severity.ERROR, element, model, null, event, (Msg.Message3) msg, msgParams[0], msgParams[1], message3);
} else if (msg instanceof Msg.Message4) {
String message = null;
if (event.getOffendingSymbol() == null) {
message = "";
} else if (event instanceof UnknownVariableErrorEvent) {
message = event.getMessage();
} else if (event.getOffendingSymbol() instanceof CommonToken) {
message = "syntax error near '" + ((CommonToken) event.getOffendingSymbol()).getText() + "'";
} else {
message = "syntax error near '" + event.getOffendingSymbol() + "'";
}
MsgUtil.reportMessage(logger, DMNMessage.Severity.ERROR, element, model, null, event, (Msg.Message4) msg, msgParams[0], msgParams[1], msgParams[2], message);
}
}
}
}
}
Aggregations