[Lada-commits] [PATCH 1 of 5] Output more comprehensive message instead of token number

Wald Commits scm-commit at wald.intevation.org
Tue Nov 1 14:21:10 CET 2016


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1478002603 -3600
# Node ID 82214fdab9c5ad2506bb1a457c56f06b9dd9fd11
# Parent  48c0132dbc85c9af7d6f429fa29dc170b11e2d21
Output more comprehensive message instead of token number.

diff -r 48c0132dbc85 -r 82214fdab9c5 src/main/java/de/intevation/lada/importer/laf/LafErrorListener.java
--- a/src/main/java/de/intevation/lada/importer/laf/LafErrorListener.java	Tue Nov 01 12:47:25 2016 +0100
+++ b/src/main/java/de/intevation/lada/importer/laf/LafErrorListener.java	Tue Nov 01 13:16:43 2016 +0100
@@ -10,30 +10,31 @@
 import de.intevation.lada.importer.ReportItem;
 
 public class LafErrorListener extends BaseErrorListener {
+
     public static LafErrorListener INSTANCE =
         new LafErrorListener();
 
     private List<ReportItem> errors = new ArrayList<ReportItem>();
 
     @Override
-    public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol,
-                            int line, int charPositionInLine,
-                            String msg, RecognitionException e)
-    {
+    public void syntaxError(
+        Recognizer<?, ?> recognizer,
+        Object offendingSymbol,
+        int line,
+        int charPositionInLine,
+        String msg,
+        RecognitionException e
+    ) {
         String sourceName = "Parser";
         if (e != null && e.getCtx() != null) {
             sourceName = e.getCtx().getText();
         }
-        String token = "Token";
-        if (e != null && e.getOffendingToken() != null) {
-            e.getOffendingToken().getText();
-        }
+
         ReportItem err = new ReportItem();
         err.setKey(sourceName);
-        err.setValue(line + ":" + charPositionInLine + " - " + token);
+        err.setValue("line " + line + ": " + msg);
         err.setCode(670);
         this.errors.add(err);
-        System.err.println(err.getKey() + " - " +err.getValue() + " - " + err.getCode());
     }
 
     public void reset() {


More information about the Lada-commits mailing list