jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [3/4] jena git commit: static default error handler
Date Fri, 28 Oct 2016 14:02:01 GMT
static default error handler


Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/e11f1850
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/e11f1850
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/e11f1850

Branch: refs/heads/master
Commit: e11f1850f6c7c3caad37cfbfd66ae980242a2d71
Parents: 6b932a5
Author: Andy Seaborne <andy@apache.org>
Authored: Thu Oct 27 22:49:04 2016 +0100
Committer: Andy Seaborne <andy@apache.org>
Committed: Thu Oct 27 22:49:04 2016 +0100

----------------------------------------------------------------------
 .../org/apache/jena/riot/tokens/TokenizerText.java | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/e11f1850/jena-arq/src/main/java/org/apache/jena/riot/tokens/TokenizerText.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/riot/tokens/TokenizerText.java b/jena-arq/src/main/java/org/apache/jena/riot/tokens/TokenizerText.java
index eb6e707..af89d05 100644
--- a/jena-arq/src/main/java/org/apache/jena/riot/tokens/TokenizerText.java
+++ b/jena-arq/src/main/java/org/apache/jena/riot/tokens/TokenizerText.java
@@ -61,31 +61,30 @@ public final class TokenizerText implements Tokenizer
     private boolean finished = false ;
     private TokenChecker checker = null ;
 
-    // The code assumes that errors throw exception and so stop parsing.
-    private ErrorHandler errorHandler = new ErrorHandler() {
-        @Override
-        public void warning(String message, long line, long col) {
+    private static class ErrorHandlerTokenizer implements ErrorHandler {
+        @Override public void warning(String message, long line, long col) {
             // Warning/continue.
             //ErrorHandlerFactory.errorHandlerStd.warning(message, line, col);
             throw new RiotParseException(message, line, col) ;
         }
 
-        @Override
-        public void error(String message, long line, long col) {
+        @Override public void error(String message, long line, long col) {
             throw new RiotParseException(message, line, col) ;
         }
 
-        @Override
-        public void fatal(String message, long line, long col) {
+        @Override public void fatal(String message, long line, long col) {
             throw new RiotParseException(message, line, col) ;
         }
     } ;
+    // The code assumes that errors throw exception and so stop parsing.
+    private static final ErrorHandler defaultErrorHandler = new ErrorHandlerTokenizer() ;
+    private ErrorHandler errorHandler = defaultErrorHandler ;
 
     /*package*/ TokenizerText(PeekReader reader) {
         this(reader, false) ;
     }
     
-    /* package */TokenizerText(PeekReader reader, boolean lineMode) {
+    /*package*/ TokenizerText(PeekReader reader, boolean lineMode) {
         this.reader = reader ;
         this.lineMode = lineMode ;
     }


Mime
View raw message