This is an automated email from the ASF dual-hosted git repository.

andy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jena.git


The following commit(s) were added to refs/heads/master by this push:
     new 33995ea  Report JSON parse problems
33995ea is described below

commit 33995ea7a547a0dca232cd697fdbd52490cba9a6
Author: Andy Seaborne <[email protected]>
AuthorDate: Sun Jan 13 18:40:14 2019 +0000

    Report JSON parse problems
---
 .../apache/jena/tdb2/setup/StoreParamsCodec.java   | 10 ++++---
 .../apache/jena/tdb/setup/StoreParamsCodec.java    | 34 +++++-----------------
 2 files changed, 13 insertions(+), 31 deletions(-)

diff --git 
a/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/setup/StoreParamsCodec.java
 
b/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/setup/StoreParamsCodec.java
index 125934b..ccc4ccc 100644
--- 
a/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/setup/StoreParamsCodec.java
+++ 
b/jena-db/jena-tdb2/src/main/java/org/apache/jena/tdb2/setup/StoreParamsCodec.java
@@ -25,10 +25,10 @@ import java.io.FileOutputStream ;
 import java.io.IOException ;
 import java.io.OutputStream ;
 
-import org.apache.jena.atlas.AtlasException ;
 import org.apache.jena.atlas.io.IO ;
 import org.apache.jena.atlas.json.* ;
 import org.apache.jena.atlas.lib.Lib ;
+import org.apache.jena.atlas.logging.FmtLog;
 import org.apache.jena.dboe.base.block.FileMode;
 import org.apache.jena.dboe.base.file.Location;
 import org.apache.jena.dboe.sys.Names;
@@ -63,9 +63,11 @@ public class StoreParamsCodec {
         try {
             JsonObject obj = JSON.read(filename) ;
             return StoreParamsCodec.decode(obj) ;
-        } 
-        catch (JsonParseException ex) { return null ; }
-        catch (AtlasException ex) { return null ; }
+        }
+        catch (JsonParseException ex) {
+            FmtLog.warn(StoreParamsCodec.class, "Ignoring store params : 
Syntax error in '%s': [line:%d, col:%d] %s", filename, ex.getLine(), 
ex.getColumn(), ex.getMessage());
+            return null ;
+        }
     }
     
     public static JsonObject encodeToJson(StoreParams params) {
diff --git 
a/jena-tdb/src/main/java/org/apache/jena/tdb/setup/StoreParamsCodec.java 
b/jena-tdb/src/main/java/org/apache/jena/tdb/setup/StoreParamsCodec.java
index c6b9614..511f6bd 100644
--- a/jena-tdb/src/main/java/org/apache/jena/tdb/setup/StoreParamsCodec.java
+++ b/jena-tdb/src/main/java/org/apache/jena/tdb/setup/StoreParamsCodec.java
@@ -18,39 +18,17 @@
 
 package org.apache.jena.tdb.setup;
 
-import static org.apache.jena.tdb.setup.StoreParamsConst.TDB_CONFIG_FILE ;
-import static org.apache.jena.tdb.setup.StoreParamsConst.fBlockReadCacheSize ;
-import static org.apache.jena.tdb.setup.StoreParamsConst.fBlockSize ;
-import static org.apache.jena.tdb.setup.StoreParamsConst.fBlockWriteCacheSize ;
-import static org.apache.jena.tdb.setup.StoreParamsConst.fFileMode ;
-import static org.apache.jena.tdb.setup.StoreParamsConst.fIndexId2Node ;
-import static org.apache.jena.tdb.setup.StoreParamsConst.fIndexNode2Id ;
-import static org.apache.jena.tdb.setup.StoreParamsConst.fIndexPrefix ;
-import static org.apache.jena.tdb.setup.StoreParamsConst.fNode2NodeIdCacheSize 
;
-import static org.apache.jena.tdb.setup.StoreParamsConst.fNodeId2NodeCacheSize 
;
-import static org.apache.jena.tdb.setup.StoreParamsConst.fNodeMissCacheSize ;
-import static org.apache.jena.tdb.setup.StoreParamsConst.fPrefixId2Node ;
-import static org.apache.jena.tdb.setup.StoreParamsConst.fPrefixIndexes ;
-import static org.apache.jena.tdb.setup.StoreParamsConst.fPrefixNode2Id ;
-import static org.apache.jena.tdb.setup.StoreParamsConst.fPrimaryIndexPrefix ;
-import static org.apache.jena.tdb.setup.StoreParamsConst.fPrimaryIndexQuads ;
-import static org.apache.jena.tdb.setup.StoreParamsConst.fPrimaryIndexTriples ;
-import static org.apache.jena.tdb.setup.StoreParamsConst.fQuadIndexes ;
-import static org.apache.jena.tdb.setup.StoreParamsConst.fTripleIndexes ;
+import static org.apache.jena.tdb.setup.StoreParamsConst.*;
 
 import java.io.BufferedOutputStream ;
 import java.io.FileOutputStream ;
 import java.io.IOException ;
 import java.io.OutputStream ;
 
-import org.apache.jena.atlas.AtlasException ;
 import org.apache.jena.atlas.io.IO ;
-import org.apache.jena.atlas.json.JSON ;
-import org.apache.jena.atlas.json.JsonParseException;
-import org.apache.jena.atlas.json.JsonArray ;
-import org.apache.jena.atlas.json.JsonBuilder ;
-import org.apache.jena.atlas.json.JsonObject ;
+import org.apache.jena.atlas.json.*;
 import org.apache.jena.atlas.lib.Lib ;
+import org.apache.jena.atlas.logging.FmtLog;
 import org.apache.jena.tdb.TDBException ;
 import org.apache.jena.tdb.base.block.FileMode ;
 import org.apache.jena.tdb.base.file.Location ;
@@ -85,8 +63,10 @@ public class StoreParamsCodec {
             JsonObject obj = JSON.read(filename) ;
             return StoreParamsCodec.decode(obj) ;
         } 
-        catch (JsonParseException ex) { return null ; }
-        catch (AtlasException ex) { return null ; }
+        catch (JsonParseException ex) {
+            FmtLog.warn(StoreParamsCodec.class, "Ignoring store params : 
Syntax error in '%s': [line:%d, col:%d] %s", filename, ex.getLine(), 
ex.getColumn(), ex.getMessage());
+            return null ;
+        }
     }
     
     public static JsonObject encodeToJson(StoreParams params) {

Reply via email to