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

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


The following commit(s) were added to refs/heads/master by this push:
     new 1dfbf22  JOHNZON-270 ensure to support ADD with pointer=''
1dfbf22 is described below

commit 1dfbf224c920872cfee892dc8684d8e1e9100258
Author: Romain Manni-Bucau <[email protected]>
AuthorDate: Sun Aug 18 20:57:56 2019 +0200

    JOHNZON-270 ensure to support ADD with pointer=''
---
 .../src/main/java/org/apache/johnzon/core/JsonPointerImpl.java   | 3 ---
 .../src/test/java/org/apache/johnzon/core/JsonPointerTest.java   | 9 ---------
 2 files changed, 12 deletions(-)

diff --git 
a/johnzon-core/src/main/java/org/apache/johnzon/core/JsonPointerImpl.java 
b/johnzon-core/src/main/java/org/apache/johnzon/core/JsonPointerImpl.java
index f73435c..6cad8c2 100644
--- a/johnzon-core/src/main/java/org/apache/johnzon/core/JsonPointerImpl.java
+++ b/johnzon-core/src/main/java/org/apache/johnzon/core/JsonPointerImpl.java
@@ -159,9 +159,6 @@ public class JsonPointerImpl implements JsonPointer {
     public JsonStructure add(JsonStructure target, JsonValue value) {
         validateAdd(target);
         if (isEmptyJsonPointer()) {
-            if (value.getClass() != target.getClass()) {
-                throw new JsonException("The value must have the same type as 
the target");
-            }
             return (JsonStructure) value;
         }
 
diff --git 
a/johnzon-core/src/test/java/org/apache/johnzon/core/JsonPointerTest.java 
b/johnzon-core/src/test/java/org/apache/johnzon/core/JsonPointerTest.java
index 81df436..b07bb6d 100644
--- a/johnzon-core/src/test/java/org/apache/johnzon/core/JsonPointerTest.java
+++ b/johnzon-core/src/test/java/org/apache/johnzon/core/JsonPointerTest.java
@@ -233,15 +233,6 @@ public class JsonPointerTest {
         jsonPointer.add((JsonStructure) null, new JsonStringImpl("qux"));
     }
 
-    @Test(expected = JsonException.class)
-    public void testAddJsonStructureWithTypeValueNotTypeTarget() {
-        JsonPointerImpl jsonPointer = new 
JsonPointerImpl(JsonProvider.provider(), "");
-        JsonObject target = Json.createObjectBuilder().build();
-        JsonArray value = Json.createArrayBuilder().build();
-
-        jsonPointer.add((JsonStructure) target, value);
-    }
-
     @Test
     public void testAddJsonStructureWithEmptyJsonPointer() {
         JsonPointerImpl jsonPointer = new 
JsonPointerImpl(JsonProvider.provider(), "");

Reply via email to