felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dlean...@apache.org
Subject svn commit: r1804738 - /felix/trunk/utils/src/main/java/org/apache/felix/utils/json/JSONParser.java
Date Thu, 10 Aug 2017 22:50:37 GMT
Author: dleangen
Date: Thu Aug 10 22:50:37 2017
New Revision: 1804738

URL: http://svn.apache.org/viewvc?rev=1804738&view=rev
Log:
[FELIX-5675] JSONParser needs a little bit more context when reporting an error

Modified:
    felix/trunk/utils/src/main/java/org/apache/felix/utils/json/JSONParser.java

Modified: felix/trunk/utils/src/main/java/org/apache/felix/utils/json/JSONParser.java
URL: http://svn.apache.org/viewvc/felix/trunk/utils/src/main/java/org/apache/felix/utils/json/JSONParser.java?rev=1804738&r1=1804737&r2=1804738&view=diff
==============================================================================
--- felix/trunk/utils/src/main/java/org/apache/felix/utils/json/JSONParser.java (original)
+++ felix/trunk/utils/src/main/java/org/apache/felix/utils/json/JSONParser.java Thu Aug 10
22:50:37 2017
@@ -197,9 +197,15 @@ public class JSONParser {
         if (jsonObject.length() == 0)
             return values;
 
+        String lastParsedObject = "[START OF DOC]";
         for (String element : parseKeyValueListRaw(jsonObject)) {
-            Pair<String, Object> pair = parseKeyValue(element);
-            values.put(pair.key, pair.value);
+            try {
+                Pair<String, Object> pair = parseKeyValue(element);
+                values.put(pair.key, pair.value);
+                lastParsedObject = jsonObject;
+            } catch (Throwable t) {
+                throw new IllegalArgumentException("An error occured after: " + lastParsedObject,
t);
+            }
         }
 
         return values;



Mime
View raw message