changeset 1130:82214fdab9c5

Output more comprehensive message instead of token number.
author Tom Gottfried <tom@intevation.de>
date Tue, 01 Nov 2016 13:16:43 +0100 (2016-11-01)
parents 48c0132dbc85
children 9964210da156
files src/main/java/de/intevation/lada/importer/laf/LafErrorListener.java
diffstat 1 files changed, 11 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- 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() {
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)