Jenkins build is still unstable: johnzon #772

2020-03-27 Thread Apache Jenkins Server
See 



Jenkins build is still unstable: johnzon #771

2020-03-27 Thread Apache Jenkins Server
See 



[johnzon] branch master updated: JOHNZON-309 more tolerance of adapters (string)

2020-03-27 Thread rmannibucau
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 ef9fc08  JOHNZON-309 more tolerance of adapters (string)
ef9fc08 is described below

commit ef9fc08a3d4846534449eb37833470837d808da7
Author: Romain Manni-Bucau 
AuthorDate: Fri Mar 27 10:41:51 2020 +0100

JOHNZON-309 more tolerance of adapters (string)
---
 .../java/org/apache/johnzon/jsonb/AdapterTest.java | 37 ++
 .../java/org/apache/johnzon/mapper/Mapper.java |  8 -
 .../org/apache/johnzon/mapper/MapperConfig.java| 32 ++-
 .../apache/johnzon/mapper/MappingParserImpl.java   | 34 ++--
 .../apache/johnzon/mapper/internal/AdapterKey.java | 18 +++
 5 files changed, 125 insertions(+), 4 deletions(-)

diff --git 
a/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/AdapterTest.java 
b/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/AdapterTest.java
index dca4576..9a69bb7 100644
--- a/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/AdapterTest.java
+++ b/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/AdapterTest.java
@@ -29,6 +29,8 @@ import javax.json.bind.JsonbConfig;
 import javax.json.bind.adapter.JsonbAdapter;
 import javax.json.bind.annotation.JsonbTypeAdapter;
 import javax.json.bind.config.PropertyOrderStrategy;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -41,6 +43,41 @@ import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
 
 public class AdapterTest {
+public static class PathAdapter implements JsonbAdapter {
+@Override
+public JsonString adaptToJson(final Path path) {
+return Json.createValue(path.toString());
+}
+
+@Override
+public Path adaptFromJson(final JsonString jsonString) {
+return Paths.get(jsonString.getString());
+}
+}
+
+public static class PathWrapper {
+public Path path;
+}
+
+@Test
+public void testSerialize() throws Exception {
+try (final Jsonb jsonb = JsonbBuilder.create(new 
JsonbConfig().withAdapters(new PathAdapter( {
+final PathWrapper wrapper = new PathWrapper();
+wrapper.path = Paths.get("/example/file.txt");
+assertEquals("{\"path\":\"/example/file.txt\"}", 
jsonb.toJson(wrapper));
+assertEquals("\"/example/file.txt\"", jsonb.toJson(wrapper.path));
+}
+}
+
+@Test
+public void testDeserialize() throws Exception {
+try (final Jsonb jsonb = JsonbBuilder.create(new 
JsonbConfig().withAdapters(new PathAdapter( {
+final Path expected = Paths.get("/example/file.txt");
+assertEquals(expected, 
jsonb.fromJson("{\"path\":\"/example/file.txt\"}", PathWrapper.class).path);
+assertEquals(expected, jsonb.fromJson("\"/example/file.txt\"", 
Path.class));
+}
+}
+
 @Test
 public void adapt() throws Exception {
 try (final Jsonb jsonb = JsonbBuilder.create(new 
JsonbConfig().withAdapters(new BarAdapter( {
diff --git a/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/Mapper.java 
b/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/Mapper.java
index 3616bf7..391c60f 100644
--- a/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/Mapper.java
+++ b/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/Mapper.java
@@ -44,6 +44,7 @@ import javax.json.JsonBuilderFactory;
 import javax.json.JsonObject;
 import javax.json.JsonReader;
 import javax.json.JsonReaderFactory;
+import javax.json.JsonString;
 import javax.json.JsonStructure;
 import javax.json.JsonValue;
 import javax.json.spi.JsonProvider;
@@ -195,8 +196,13 @@ public class Mapper implements Closeable {
 return;
 }
 
+final Adapter adapter = config.findAdapter(object.getClass());
+if (adapter != null && TypeAwareAdapter.class.isInstance(adapter) && 
TypeAwareAdapter.class.cast(adapter).getTo() == JsonString.class) {
+writeObject(adapter.from(object), stream);
+return;
+}
 try (final JsonGenerator generator = 
generatorFactory.createGenerator(stream(stream))) {
-writeObjectWithGenerator(object, generator);
+writeObjectWithGenerator(adapter == null ? object : 
adapter.from(object), generator);
 }
 }
 
diff --git 
a/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/MapperConfig.java 
b/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/MapperConfig.java
index d3ef464..3046376 100644
--- a/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/MapperConfig.java
+++ b/johnzon-mapper/src/main/java/org/apache/johnzon/mapper/MapperConfig.java
@@ -26,14 +26,18 @@ import 

Jenkins build is still unstable: johnzon #770

2020-03-27 Thread Apache Jenkins Server
See 



svn commit: r38648 - in /dev/johnzon: apache-johnzon-1.2.4-src.zip apache-johnzon-1.2.4-src.zip.asc apache-johnzon-1.2.4-src.zip.sha512

2020-03-27 Thread rmannibucau
Author: rmannibucau
Date: Fri Mar 27 08:18:31 2020
New Revision: 38648

Log:
johnzon 1.2.4 dev staging area

Added:
dev/johnzon/apache-johnzon-1.2.4-src.zip   (with props)
dev/johnzon/apache-johnzon-1.2.4-src.zip.asc
dev/johnzon/apache-johnzon-1.2.4-src.zip.sha512

Added: dev/johnzon/apache-johnzon-1.2.4-src.zip
==
Binary file - no diff available.

Propchange: dev/johnzon/apache-johnzon-1.2.4-src.zip
--
svn:mime-type = application/octet-stream

Added: dev/johnzon/apache-johnzon-1.2.4-src.zip.asc
==
--- dev/johnzon/apache-johnzon-1.2.4-src.zip.asc (added)
+++ dev/johnzon/apache-johnzon-1.2.4-src.zip.asc Fri Mar 27 08:18:31 2020
@@ -0,0 +1,11 @@
+-BEGIN PGP SIGNATURE-
+
+iQEzBAABCgAdFiEEz4CgVaKtKOnvv5QqcxKfWN5h7L0FAl59tc0ACgkQcxKfWN5h
+7L1m1wf+MZG59eyNCO03Abt1xvWJlgXVju5wVx6mYlaSM32AwvxDsTP1JYIoraF9
+8D6XvCHXeIk08jGFWpQuyE/q4TcwgMGO/wq2cwKVHqc16DAH1APOD0gom/XpfxdP
+/FKylVLs/5mJzpyNynX4VNErGcAGREqdolmseDtT0FcyECicm+pKWL76i5lXO5r/
+wRKWnSJ3Brm0mBpCTM63h3NNlALjvaVgeqTnVJroBSlpupMn0QeDI1H3KDiIg+PL
+z9GNsS2ljC1zi5iITExj5qtxCYJ6L17eOegm1a/Ht3E8/mzYy8GvCcJhyBquLx59
+Dp9ZIEItZotba/uysq+4yatHH5SZqw==
+=7Vuf
+-END PGP SIGNATURE-

Added: dev/johnzon/apache-johnzon-1.2.4-src.zip.sha512
==
--- dev/johnzon/apache-johnzon-1.2.4-src.zip.sha512 (added)
+++ dev/johnzon/apache-johnzon-1.2.4-src.zip.sha512 Fri Mar 27 08:18:31 2020
@@ -0,0 +1 @@
+1591bad1c714e86bce52b81b9d582cfdc47e82a68582903c211bbf5da50f7edba138fdbdfca461d957759f198d159de7e6d3ac4145be250f53b947bb926d1e56
  apache-johnzon-1.2.4-src.zip




Jenkins build is still unstable: johnzon #769

2020-03-27 Thread Apache Jenkins Server
See 



[johnzon] 01/02: [maven-release-plugin] prepare release v1.2.4

2020-03-27 Thread rmannibucau
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

commit 413b0256409fb64b6c7b8de84be02e4f08ddd49f
Author: Romain Manni-Bucau 
AuthorDate: Fri Mar 27 09:11:16 2020 +0100

[maven-release-plugin] prepare release v1.2.4
---
 johnzon-core/pom.xml | 2 +-
 johnzon-distribution/pom.xml | 2 +-
 johnzon-jaxrs/pom.xml| 2 +-
 johnzon-json-extras/pom.xml  | 2 +-
 johnzon-jsonb/pom.xml| 2 +-
 johnzon-jsonschema/pom.xml   | 2 +-
 johnzon-mapper/pom.xml   | 2 +-
 johnzon-maven-plugin/pom.xml | 2 +-
 johnzon-osgi/pom.xml | 2 +-
 johnzon-websocket/pom.xml| 2 +-
 pom.xml  | 4 ++--
 11 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/johnzon-core/pom.xml b/johnzon-core/pom.xml
index 2e8c768..83f5c88 100644
--- a/johnzon-core/pom.xml
+++ b/johnzon-core/pom.xml
@@ -21,7 +21,7 @@
   
 johnzon
 org.apache.johnzon
-1.2.4-SNAPSHOT
+1.2.4
   
   4.0.0
 
diff --git a/johnzon-distribution/pom.xml b/johnzon-distribution/pom.xml
index 091b08c..bf9c25c 100644
--- a/johnzon-distribution/pom.xml
+++ b/johnzon-distribution/pom.xml
@@ -21,7 +21,7 @@
   
 johnzon
 org.apache.johnzon
-1.2.4-SNAPSHOT
+1.2.4
   
   4.0.0
 
diff --git a/johnzon-jaxrs/pom.xml b/johnzon-jaxrs/pom.xml
index 16775e5..7f0fe0f 100644
--- a/johnzon-jaxrs/pom.xml
+++ b/johnzon-jaxrs/pom.xml
@@ -21,7 +21,7 @@
   
 johnzon
 org.apache.johnzon
-1.2.4-SNAPSHOT
+1.2.4
   
   4.0.0
 
diff --git a/johnzon-json-extras/pom.xml b/johnzon-json-extras/pom.xml
index 456dafe..aad6737 100644
--- a/johnzon-json-extras/pom.xml
+++ b/johnzon-json-extras/pom.xml
@@ -21,7 +21,7 @@
   
 johnzon
 org.apache.johnzon
-1.2.4-SNAPSHOT
+1.2.4
   
   4.0.0
 
diff --git a/johnzon-jsonb/pom.xml b/johnzon-jsonb/pom.xml
index fd0a1ce..fff285d 100644
--- a/johnzon-jsonb/pom.xml
+++ b/johnzon-jsonb/pom.xml
@@ -21,7 +21,7 @@
   
 johnzon
 org.apache.johnzon
-1.2.4-SNAPSHOT
+1.2.4
   
   4.0.0
 
diff --git a/johnzon-jsonschema/pom.xml b/johnzon-jsonschema/pom.xml
index 8b0f872..95fa63c 100644
--- a/johnzon-jsonschema/pom.xml
+++ b/johnzon-jsonschema/pom.xml
@@ -21,7 +21,7 @@
   
 johnzon
 org.apache.johnzon
-1.2.4-SNAPSHOT
+1.2.4
   
   4.0.0
 
diff --git a/johnzon-mapper/pom.xml b/johnzon-mapper/pom.xml
index f78e977..876093d 100644
--- a/johnzon-mapper/pom.xml
+++ b/johnzon-mapper/pom.xml
@@ -21,7 +21,7 @@
   
 johnzon
 org.apache.johnzon
-1.2.4-SNAPSHOT
+1.2.4
   
   4.0.0
 
diff --git a/johnzon-maven-plugin/pom.xml b/johnzon-maven-plugin/pom.xml
index 07d1036..2c3d2c2 100644
--- a/johnzon-maven-plugin/pom.xml
+++ b/johnzon-maven-plugin/pom.xml
@@ -23,7 +23,7 @@
   
 johnzon
 org.apache.johnzon
-1.2.4-SNAPSHOT
+1.2.4
   
 
   johnzon-maven-plugin
diff --git a/johnzon-osgi/pom.xml b/johnzon-osgi/pom.xml
index 8af8cc8..d8b7448 100644
--- a/johnzon-osgi/pom.xml
+++ b/johnzon-osgi/pom.xml
@@ -21,7 +21,7 @@
   
 johnzon
 org.apache.johnzon
-1.2.4-SNAPSHOT
+1.2.4
   
   4.0.0
 
diff --git a/johnzon-websocket/pom.xml b/johnzon-websocket/pom.xml
index 07854c2..768b48d 100644
--- a/johnzon-websocket/pom.xml
+++ b/johnzon-websocket/pom.xml
@@ -21,7 +21,7 @@
   
 johnzon
 org.apache.johnzon
-1.2.4-SNAPSHOT
+1.2.4
   
   4.0.0
 
diff --git a/pom.xml b/pom.xml
index 0858753..f8b147f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,7 +29,7 @@
   org.apache.johnzon
   johnzon
   pom
-  1.2.4-SNAPSHOT
+  1.2.4
   Apache Johnzon
   Apache Johnzon is an implementation of JSR-353 (JavaTM API for 
JSON Processing).
   2014
@@ -427,7 +427,7 @@
 
scm:git:https://git-wip-us.apache.org/repos/asf/johnzon.git
 
scm:git:https://git-wip-us.apache.org/repos/asf/johnzon.git
 https://git-wip-us.apache.org/repos/asf?p=johnzon.git
-HEAD
+v1.2.4
   
 
   



[johnzon] branch master updated (7b19841 -> 10f6afa)

2020-03-27 Thread rmannibucau
This is an automated email from the ASF dual-hosted git repository.

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


from 7b19841  ensure '-' token is used for pointer.remove and not skipped 
due to number pattern check
 new 413b025  [maven-release-plugin] prepare release v1.2.4
 new 10f6afa  [maven-release-plugin] prepare for next development iteration

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 johnzon-core/pom.xml | 2 +-
 johnzon-distribution/pom.xml | 2 +-
 johnzon-jaxrs/pom.xml| 2 +-
 johnzon-json-extras/pom.xml  | 2 +-
 johnzon-jsonb/pom.xml| 2 +-
 johnzon-jsonschema/pom.xml   | 2 +-
 johnzon-mapper/pom.xml   | 2 +-
 johnzon-maven-plugin/pom.xml | 2 +-
 johnzon-osgi/pom.xml | 2 +-
 johnzon-websocket/pom.xml| 2 +-
 pom.xml  | 2 +-
 11 files changed, 11 insertions(+), 11 deletions(-)



[johnzon] 02/02: [maven-release-plugin] prepare for next development iteration

2020-03-27 Thread rmannibucau
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

commit 10f6afa981bebefc60d67727f2049d9d65d09b21
Author: Romain Manni-Bucau 
AuthorDate: Fri Mar 27 09:11:26 2020 +0100

[maven-release-plugin] prepare for next development iteration
---
 johnzon-core/pom.xml | 2 +-
 johnzon-distribution/pom.xml | 2 +-
 johnzon-jaxrs/pom.xml| 2 +-
 johnzon-json-extras/pom.xml  | 2 +-
 johnzon-jsonb/pom.xml| 2 +-
 johnzon-jsonschema/pom.xml   | 2 +-
 johnzon-mapper/pom.xml   | 2 +-
 johnzon-maven-plugin/pom.xml | 2 +-
 johnzon-osgi/pom.xml | 2 +-
 johnzon-websocket/pom.xml| 2 +-
 pom.xml  | 4 ++--
 11 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/johnzon-core/pom.xml b/johnzon-core/pom.xml
index 83f5c88..6f6dca5 100644
--- a/johnzon-core/pom.xml
+++ b/johnzon-core/pom.xml
@@ -21,7 +21,7 @@
   
 johnzon
 org.apache.johnzon
-1.2.4
+1.2.5-SNAPSHOT
   
   4.0.0
 
diff --git a/johnzon-distribution/pom.xml b/johnzon-distribution/pom.xml
index bf9c25c..d5c9fd3 100644
--- a/johnzon-distribution/pom.xml
+++ b/johnzon-distribution/pom.xml
@@ -21,7 +21,7 @@
   
 johnzon
 org.apache.johnzon
-1.2.4
+1.2.5-SNAPSHOT
   
   4.0.0
 
diff --git a/johnzon-jaxrs/pom.xml b/johnzon-jaxrs/pom.xml
index 7f0fe0f..72a89a6 100644
--- a/johnzon-jaxrs/pom.xml
+++ b/johnzon-jaxrs/pom.xml
@@ -21,7 +21,7 @@
   
 johnzon
 org.apache.johnzon
-1.2.4
+1.2.5-SNAPSHOT
   
   4.0.0
 
diff --git a/johnzon-json-extras/pom.xml b/johnzon-json-extras/pom.xml
index aad6737..62f883b 100644
--- a/johnzon-json-extras/pom.xml
+++ b/johnzon-json-extras/pom.xml
@@ -21,7 +21,7 @@
   
 johnzon
 org.apache.johnzon
-1.2.4
+1.2.5-SNAPSHOT
   
   4.0.0
 
diff --git a/johnzon-jsonb/pom.xml b/johnzon-jsonb/pom.xml
index fff285d..6fa4b68 100644
--- a/johnzon-jsonb/pom.xml
+++ b/johnzon-jsonb/pom.xml
@@ -21,7 +21,7 @@
   
 johnzon
 org.apache.johnzon
-1.2.4
+1.2.5-SNAPSHOT
   
   4.0.0
 
diff --git a/johnzon-jsonschema/pom.xml b/johnzon-jsonschema/pom.xml
index 95fa63c..ebc0d41 100644
--- a/johnzon-jsonschema/pom.xml
+++ b/johnzon-jsonschema/pom.xml
@@ -21,7 +21,7 @@
   
 johnzon
 org.apache.johnzon
-1.2.4
+1.2.5-SNAPSHOT
   
   4.0.0
 
diff --git a/johnzon-mapper/pom.xml b/johnzon-mapper/pom.xml
index 876093d..6be32d6 100644
--- a/johnzon-mapper/pom.xml
+++ b/johnzon-mapper/pom.xml
@@ -21,7 +21,7 @@
   
 johnzon
 org.apache.johnzon
-1.2.4
+1.2.5-SNAPSHOT
   
   4.0.0
 
diff --git a/johnzon-maven-plugin/pom.xml b/johnzon-maven-plugin/pom.xml
index 2c3d2c2..22789cf 100644
--- a/johnzon-maven-plugin/pom.xml
+++ b/johnzon-maven-plugin/pom.xml
@@ -23,7 +23,7 @@
   
 johnzon
 org.apache.johnzon
-1.2.4
+1.2.5-SNAPSHOT
   
 
   johnzon-maven-plugin
diff --git a/johnzon-osgi/pom.xml b/johnzon-osgi/pom.xml
index d8b7448..75dc2fb 100644
--- a/johnzon-osgi/pom.xml
+++ b/johnzon-osgi/pom.xml
@@ -21,7 +21,7 @@
   
 johnzon
 org.apache.johnzon
-1.2.4
+1.2.5-SNAPSHOT
   
   4.0.0
 
diff --git a/johnzon-websocket/pom.xml b/johnzon-websocket/pom.xml
index 768b48d..ecd507a 100644
--- a/johnzon-websocket/pom.xml
+++ b/johnzon-websocket/pom.xml
@@ -21,7 +21,7 @@
   
 johnzon
 org.apache.johnzon
-1.2.4
+1.2.5-SNAPSHOT
   
   4.0.0
 
diff --git a/pom.xml b/pom.xml
index f8b147f..7a672fc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,7 +29,7 @@
   org.apache.johnzon
   johnzon
   pom
-  1.2.4
+  1.2.5-SNAPSHOT
   Apache Johnzon
   Apache Johnzon is an implementation of JSR-353 (JavaTM API for 
JSON Processing).
   2014
@@ -427,7 +427,7 @@
 
scm:git:https://git-wip-us.apache.org/repos/asf/johnzon.git
 
scm:git:https://git-wip-us.apache.org/repos/asf/johnzon.git
 https://git-wip-us.apache.org/repos/asf?p=johnzon.git
-v1.2.4
+HEAD
   
 
   



[johnzon] annotated tag v1.2.4 created (now cdbc7d3)

2020-03-27 Thread rmannibucau
This is an automated email from the ASF dual-hosted git repository.

rmannibucau pushed a change to annotated tag v1.2.4
in repository https://gitbox.apache.org/repos/asf/johnzon.git.


  at cdbc7d3  (tag)
 tagging 413b0256409fb64b6c7b8de84be02e4f08ddd49f (commit)
 replaces v1.2.3
  by Romain Manni-Bucau
  on Fri Mar 27 09:11:26 2020 +0100

- Log -
[maven-release-plugin] copy for tag v1.2.4
---

This annotated tag includes the following new commits:

 new 413b025  [maven-release-plugin] prepare release v1.2.4

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.




[johnzon] branch master updated: ensure '-' token is used for pointer.remove and not skipped due to number pattern check

2020-03-27 Thread rmannibucau
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 7b19841  ensure '-' token is used for pointer.remove and not skipped 
due to number pattern check
7b19841 is described below

commit 7b198413cc858be387e82d3f639364b14a5742dd
Author: Romain Manni-Bucau 
AuthorDate: Fri Mar 27 09:09:42 2020 +0100

ensure '-' token is used for pointer.remove and not skipped due to number 
pattern check
---
 .../main/java/org/apache/johnzon/core/JsonPointerImpl.java  |  4 ++--
 .../test/java/org/apache/johnzon/core/JsonPatchTest.java|  2 +-
 .../test/java/org/apache/johnzon/core/JsonPointerTest.java  | 13 +
 3 files changed, 16 insertions(+), 3 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 46d62b3..e9cd32c 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
@@ -437,9 +437,9 @@ public class JsonPointerImpl implements JsonPointer {
 return objectBuilder.build();
 } else if (jsonValue.getValueType() == JsonValue.ValueType.ARRAY) {
 final JsonArray jsonArray = jsonValue.asJsonArray();
-if (IS_NUMBER.matcher(token).matches()) {
-final JsonArrayBuilder arrayBuilder = 
provider.createArrayBuilder();
+if ("-".equals(token) || IS_NUMBER.matcher(token).matches()) {
 final int arrayIndex = getArrayIndex(token, jsonArray, false);
+final JsonArrayBuilder arrayBuilder = 
provider.createArrayBuilder();
 final int jsonArraySize = jsonArray.size();
 for (int i = 0; i < jsonArraySize; i++) {
 final boolean matchesIndex = i == arrayIndex;
diff --git 
a/johnzon-core/src/test/java/org/apache/johnzon/core/JsonPatchTest.java 
b/johnzon-core/src/test/java/org/apache/johnzon/core/JsonPatchTest.java
index 6d9b41e..a255271 100644
--- a/johnzon-core/src/test/java/org/apache/johnzon/core/JsonPatchTest.java
+++ b/johnzon-core/src/test/java/org/apache/johnzon/core/JsonPatchTest.java
@@ -717,7 +717,7 @@ public class JsonPatchTest {
   .build();
 
 JsonPatchImpl patch = new JsonPatchImpl(PROVIDER, new 
JsonPatchImpl.PatchValue(PROVIDER, JsonPatch.Operation.COPY,
- 
"/1",
+ 
"/2",
  
"/-",
  
null));
 
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 bf99d2d..2b840b2 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
@@ -470,6 +470,19 @@ public class JsonPointerTest {
 }
 
 @Test
+public void testRemoveLastArrayElementSimple() {
+JsonPointerImpl jsonPointer = new 
JsonPointerImpl(JsonProvider.provider(), "/-");
+JsonStructure target = Json.createArrayBuilder()
+.add("bar")
+.add("qux")
+.add("baz")
+.build();
+
+JsonStructure result = jsonPointer.remove(target);
+assertEquals("[\"bar\",\"qux\"]", result.toString());
+}
+
+@Test
 public void testRemoveObjectMember() {
 JsonPointerImpl jsonPointer = new 
JsonPointerImpl(JsonProvider.provider(), "/baz");
 JsonStructure target = Json.createObjectBuilder()



Jenkins build is still unstable: johnzon #768

2020-03-27 Thread Apache Jenkins Server
See 



[johnzon] 02/02: Fixed faulty comment in test.

2020-03-27 Thread rmannibucau
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

commit 8f323594b77c99e046097dcc718212fcf8554780
Author: Markus Paeschke 
AuthorDate: Fri Mar 20 11:42:54 2020 +0100

Fixed faulty comment in test.
---
 johnzon-core/src/test/java/org/apache/johnzon/core/JsonPointerTest.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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 f2b7164..bf99d2d 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
@@ -466,7 +466,7 @@ public class JsonPointerTest {
 .add("baz")).build(); // [["bar","qux","baz"]]
 
 JsonStructure result = jsonPointer.remove(target);
-assertEquals("[[\"bar\",\"qux\"]]", result.toString()); // 
[["bar","baz"]]
+assertEquals("[[\"bar\",\"qux\"]]", result.toString()); // 
[["bar","qux"]]
 }
 
 @Test



[johnzon] branch master updated (695a887 -> 8f32359)

2020-03-27 Thread rmannibucau
This is an automated email from the ASF dual-hosted git repository.

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


from 695a887  JOHNZON-306 more details on which field/method failed to bind
 new 2511bab  Added possibility to use minus as array index for the remove 
operation.
 new 8f32359  Fixed faulty comment in test.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../main/java/org/apache/johnzon/core/JsonPointerImpl.java  |  7 ---
 .../test/java/org/apache/johnzon/core/JsonPointerTest.java  | 13 +
 2 files changed, 17 insertions(+), 3 deletions(-)



[johnzon] 01/02: Added possibility to use minus as array index for the remove operation.

2020-03-27 Thread rmannibucau
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

commit 2511babf3fc4e272a40183e9e5606009231ee6d5
Author: Markus Paeschke 
AuthorDate: Fri Mar 20 10:58:44 2020 +0100

Added possibility to use minus as array index for the remove operation.
---
 .../main/java/org/apache/johnzon/core/JsonPointerImpl.java  |  7 ---
 .../test/java/org/apache/johnzon/core/JsonPointerTest.java  | 13 +
 2 files changed, 17 insertions(+), 3 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 89eed57..46d62b3 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
@@ -339,8 +339,7 @@ public class JsonPointerImpl implements JsonPointer {
 
 try {
 JsonArray jsonArray = (JsonArray) jsonValue;
-int arrayIndex = Integer.parseInt(referenceToken);
-validateArraySize(jsonArray, arrayIndex, jsonArray.size());
+int arrayIndex = getArrayIndex(referenceToken, jsonArray, 
false);
 return jsonArray.get(arrayIndex);
 } catch (NumberFormatException e) {
 throw new JsonException("'" + referenceToken + "' is no valid 
array index", e);
@@ -460,6 +459,8 @@ public class JsonPointerImpl implements JsonPointer {
 private int getArrayIndex(String referenceToken, JsonArray jsonArray, 
boolean addOperation) {
 if (addOperation && referenceToken.equals("-")) {
 return jsonArray.size();
+} else if (!addOperation && referenceToken.equals("-")) {
+return jsonArray.size() - 1;
 }
 
 validateArrayIndex(referenceToken);
@@ -486,7 +487,7 @@ public class JsonPointerImpl implements JsonPointer {
 }
 
 private void validateArrayIndex(String referenceToken) throws 
JsonException {
-if (referenceToken.startsWith("+") || referenceToken.startsWith("-")) {
+if (referenceToken.startsWith("+") || (referenceToken.startsWith("-") 
&& referenceToken.length() > 1)) {
 throw new JsonException("An array index must not start with '" + 
referenceToken.charAt(0) + "'");
 }
 if (referenceToken.startsWith("0") && referenceToken.length() > 1) {
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 b07bb6d..f2b7164 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
@@ -457,6 +457,19 @@ public class JsonPointerTest {
 }
 
 @Test
+public void testRemoveLastArrayElement() {
+JsonPointerImpl jsonPointer = new 
JsonPointerImpl(JsonProvider.provider(), "/0/-");
+JsonStructure target = Json.createArrayBuilder()
+.add(Json.createArrayBuilder()
+.add("bar")
+.add("qux")
+.add("baz")).build(); // [["bar","qux","baz"]]
+
+JsonStructure result = jsonPointer.remove(target);
+assertEquals("[[\"bar\",\"qux\"]]", result.toString()); // 
[["bar","baz"]]
+}
+
+@Test
 public void testRemoveObjectMember() {
 JsonPointerImpl jsonPointer = new 
JsonPointerImpl(JsonProvider.provider(), "/baz");
 JsonStructure target = Json.createObjectBuilder()