[johnzon] branch master updated: Checkstyle

2021-09-21 Thread jlmonteiro
This is an automated email from the ASF dual-hosted git repository.

jlmonteiro 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 d7daa44  Checkstyle
d7daa44 is described below

commit d7daa4428f95674a65818ac9d878f8a229f5f879
Author: Jean-Louis Monteiro 
AuthorDate: Tue Sep 21 11:24:48 2021 +0200

Checkstyle

Signed-off-by: Jean-Louis Monteiro 
---
 johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/JsonbReadTest.java | 1 -
 1 file changed, 1 deletion(-)

diff --git 
a/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/JsonbReadTest.java 
b/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/JsonbReadTest.java
index 8656416..5d85a40 100644
--- a/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/JsonbReadTest.java
+++ b/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/JsonbReadTest.java
@@ -30,7 +30,6 @@ import javax.json.bind.config.BinaryDataStrategy;
 import javax.json.bind.spi.JsonbProvider;
 
 import java.io.ByteArrayInputStream;
-import java.io.InputStream;
 import java.io.StringReader;
 import java.lang.reflect.Type;
 import java.nio.charset.StandardCharsets;


[johnzon] branch master updated: JOHNZON-351 support collection raw classes cast to Type in JSON-B Improve tests and case coverage

2021-09-21 Thread jlmonteiro
This is an automated email from the ASF dual-hosted git repository.

jlmonteiro 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 64e7727  JOHNZON-351 support collection raw classes cast to Type in 
JSON-B Improve tests and case coverage
64e7727 is described below

commit 64e7727fee45344659028f6e8a814486086f03b7
Author: Jean-Louis Monteiro 
AuthorDate: Tue Sep 21 11:20:10 2021 +0200

JOHNZON-351 support collection raw classes cast to Type in JSON-B
Improve tests and case coverage

Signed-off-by: Jean-Louis Monteiro 
---
 .../java/org/apache/johnzon/jsonb/JohnzonJsonb.java  |  4 ++--
 .../java/org/apache/johnzon/jsonb/JsonbReadTest.java | 20 
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git 
a/johnzon-jsonb/src/main/java/org/apache/johnzon/jsonb/JohnzonJsonb.java 
b/johnzon-jsonb/src/main/java/org/apache/johnzon/jsonb/JohnzonJsonb.java
index bd9e9bc..69c4816 100644
--- a/johnzon-jsonb/src/main/java/org/apache/johnzon/jsonb/JohnzonJsonb.java
+++ b/johnzon-jsonb/src/main/java/org/apache/johnzon/jsonb/JohnzonJsonb.java
@@ -197,7 +197,7 @@ public class JohnzonJsonb implements Jsonb, AutoCloseable, 
JsonbExtension {
 } else if (JsonArray.class == runtimeType) {
 return (T) delegate.readJsonArray(reader);
 } else if (isCollection(runtimeType)) {
-return (T) delegate.readCollection(reader, 
ParameterizedType.class.cast(runtimeType));
+return (T) delegate.readCollection(reader, 
toCollectionType(runtimeType));
 }
 final Type mappingType = unwrapPrimitiveOptional(runtimeType);
 final Object object = delegate.readObject(reader, mappingType);
@@ -240,7 +240,7 @@ public class JohnzonJsonb implements Jsonb, AutoCloseable, 
JsonbExtension {
 } else if (JsonArray.class == runtimeType) {
 return (T) delegate.readJsonArray(stream);
 } else if (isCollection(runtimeType)) {
-return (T) delegate.readCollection(stream, 
ParameterizedType.class.cast(runtimeType));
+return (T) delegate.readCollection(stream, 
toCollectionType(runtimeType));
 }
 
 final Type mappingType = unwrapPrimitiveOptional(runtimeType);
diff --git 
a/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/JsonbReadTest.java 
b/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/JsonbReadTest.java
index 3ac7a48..8656416 100644
--- a/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/JsonbReadTest.java
+++ b/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/JsonbReadTest.java
@@ -30,6 +30,7 @@ import javax.json.bind.config.BinaryDataStrategy;
 import javax.json.bind.spi.JsonbProvider;
 
 import java.io.ByteArrayInputStream;
+import java.io.InputStream;
 import java.io.StringReader;
 import java.lang.reflect.Type;
 import java.nio.charset.StandardCharsets;
@@ -53,6 +54,25 @@ public class JsonbReadTest {
 }
 
 @Test
+public void simpleArrayMappingReader() throws Exception {
+final List expectedResult = asList("Test String");
+try (final Jsonb jsonb = JsonbBuilder.create()) {
+final Object unmarshalledObject = jsonb.fromJson(new 
StringReader("[ \"Test String\" ]"), (Type) List.class);
+assertEquals(expectedResult, unmarshalledObject);
+}
+}
+
+@Test
+public void simpleArrayMappingInputStream() throws Exception {
+final List expectedResult = asList("Test String");
+try (final Jsonb jsonb = JsonbBuilder.create()) {
+final Object unmarshalledObject = jsonb.fromJson(new 
ByteArrayInputStream("[ \"Test String\" ]".getBytes(
+StandardCharsets.UTF_8)), (Type) List.class);
+assertEquals(expectedResult, unmarshalledObject);
+}
+}
+
+@Test
 public void boolFromString() {
 assertTrue(JsonbProvider.provider().create().build().fromJson("true", 
Boolean.class));
 }


[johnzon] branch master updated (7751e96 -> 1759351)

2021-09-21 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 7751e96  True object and array streaming (#74)
 new 3b56f6b  download 1.2.14
 new 1759351  JOHNZON-351 support collection raw classes cast to Type in 
JSON-B

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/jsonb/JohnzonJsonb.java|  9 -
 .../test/java/org/apache/johnzon/jsonb/JsonbReadTest.java   | 13 +
 src/site/markdown/download.md   | 12 ++--
 3 files changed, 27 insertions(+), 7 deletions(-)


[johnzon] 01/02: download 1.2.14

2021-09-21 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 3b56f6b0811577c58a10bfb8086b63644304e1dc
Author: Romain Manni-Bucau 
AuthorDate: Mon Jul 5 08:55:01 2021 +0200

download 1.2.14
---
 src/site/markdown/download.md | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/site/markdown/download.md b/src/site/markdown/download.md
index 48ebb0d..f61db2d 100644
--- a/src/site/markdown/download.md
+++ b/src/site/markdown/download.md
@@ -41,16 +41,16 @@ Apache Johnzon 1.2.x implements the JSON-P 1.1 and JSON-B 
1.0 specifications whi
  Binaries
 The binary distribution contains all Johnzon modules.
 
-* 
[apache-johnzon-1.2.13-bin.zip](https://www.apache.org/dyn/closer.lua/johnzon/johnzon-1.2.13/apache-johnzon-1.2.13-bin.zip)
-* 
[apache-johnzon-1.2.13-bin.zip.sha1](https://www.apache.org/dist/johnzon/johnzon-1.2.13/apache-johnzon-1.2.13-bin.zip.sha1)
-* 
[apache-johnzon-1.2.13-bin.zip.asc](https://www.apache.org/dist/johnzon/johnzon-1.2.13/apache-johnzon-1.2.13-bin.zip.asc)
+* 
[apache-johnzon-1.2.14-bin.zip](https://www.apache.org/dyn/closer.lua/johnzon/johnzon-1.2.14/apache-johnzon-1.2.14-bin.zip)
+* 
[apache-johnzon-1.2.14-bin.zip.sha1](https://www.apache.org/dist/johnzon/johnzon-1.2.14/apache-johnzon-1.2.14-bin.zip.sha1)
+* 
[apache-johnzon-1.2.14-bin.zip.asc](https://www.apache.org/dist/johnzon/johnzon-1.2.14/apache-johnzon-1.2.14-bin.zip.asc)
 
  Source
 Should you want to build any of the above binaries, this source bundle is the 
right one and covers them all.
 
-* 
[johnzon-1.2.13-source-release.zip](https://www.apache.org/dyn/closer.lua/johnzon/johnzon-1.2.13/johnzon-1.2.13-source-release.zip)
-* 
[johnzon-1.2.13-source-release.zip.sha1](https://www.apache.org/dist/johnzon/johnzon-1.2.13/johnzon-1.2.13-source-release.zip.sha1)
-* 
[johnzon-1.2.13-source-release.zip.asc](https://www.apache.org/dist/johnzon/johnzon-1.2.13/johnzon-1.2.13-source-release.zip.asc)
+* 
[johnzon-1.2.14-source-release.zip](https://www.apache.org/dyn/closer.lua/johnzon/johnzon-1.2.14/johnzon-1.2.14-source-release.zip)
+* 
[johnzon-1.2.14-source-release.zip.sha1](https://www.apache.org/dist/johnzon/johnzon-1.2.14/johnzon-1.2.14-source-release.zip.sha1)
+* 
[johnzon-1.2.14-source-release.zip.asc](https://www.apache.org/dist/johnzon/johnzon-1.2.14/johnzon-1.2.14-source-release.zip.asc)
 
 
 ## Johnzon-1.0.x


[johnzon] 02/02: JOHNZON-351 support collection raw classes cast to Type in JSON-B

2021-09-21 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 17593519c58eb07c4a7d8bc2a07d09ba11a51c00
Author: Romain Manni-Bucau 
AuthorDate: Tue Sep 21 10:58:09 2021 +0200

JOHNZON-351 support collection raw classes cast to Type in JSON-B
---
 .../main/java/org/apache/johnzon/jsonb/JohnzonJsonb.java|  9 -
 .../test/java/org/apache/johnzon/jsonb/JsonbReadTest.java   | 13 +
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git 
a/johnzon-jsonb/src/main/java/org/apache/johnzon/jsonb/JohnzonJsonb.java 
b/johnzon-jsonb/src/main/java/org/apache/johnzon/jsonb/JohnzonJsonb.java
index 1d6f1b1..bd9e9bc 100644
--- a/johnzon-jsonb/src/main/java/org/apache/johnzon/jsonb/JohnzonJsonb.java
+++ b/johnzon-jsonb/src/main/java/org/apache/johnzon/jsonb/JohnzonJsonb.java
@@ -136,7 +136,7 @@ public class JohnzonJsonb implements Jsonb, AutoCloseable, 
JsonbExtension {
 } else if (JsonArray.class == runtimeType) {
 return (T) delegate.readJsonArray(new StringReader(str));
 } else if (isCollection(runtimeType)) {
-return (T) delegate.readCollection(new StringReader(str), 
ParameterizedType.class.cast(runtimeType));
+return (T) delegate.readCollection(new StringReader(str), 
toCollectionType(runtimeType));
 }
 final Type mappingType = unwrapPrimitiveOptional(runtimeType);
 final Object object = delegate.readObject(str, mappingType);
@@ -613,4 +613,11 @@ public class JohnzonJsonb implements Jsonb, AutoCloseable, 
JsonbExtension {
 
Class.class.isInstance(pt.getActualTypeArguments()[0]) &&
 
JsonValue.class.isAssignableFrom(Class.class.cast(pt.getActualTypeArguments()[0])));
 }
+
+private ParameterizedType toCollectionType(final Type runtimeType) {
+if (ParameterizedType.class.isInstance(runtimeType)) {
+return ParameterizedType.class.cast(runtimeType);
+}
+return new JohnzonParameterizedType(runtimeType, Object.class);
+}
 }
diff --git 
a/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/JsonbReadTest.java 
b/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/JsonbReadTest.java
index bd63127..3ac7a48 100644
--- a/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/JsonbReadTest.java
+++ b/johnzon-jsonb/src/test/java/org/apache/johnzon/jsonb/JsonbReadTest.java
@@ -20,6 +20,8 @@ package org.apache.johnzon.jsonb;
 
 import org.junit.Test;
 
+import javax.json.bind.Jsonb;
+import javax.json.bind.JsonbBuilder;
 import javax.json.bind.JsonbConfig;
 import javax.json.bind.JsonbException;
 import javax.json.bind.annotation.JsonbDateFormat;
@@ -29,15 +31,26 @@ import javax.json.bind.spi.JsonbProvider;
 
 import java.io.ByteArrayInputStream;
 import java.io.StringReader;
+import java.lang.reflect.Type;
 import java.nio.charset.StandardCharsets;
 import java.time.LocalDate;
 import java.time.format.DateTimeFormatter;
 import java.util.Base64;
+import java.util.List;
 
+import static java.util.Arrays.asList;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
 public class JsonbReadTest {
+@Test
+public void simpleArrayMapping() throws Exception {
+final List expectedResult = asList("Test String");
+try (final Jsonb jsonb = JsonbBuilder.create()) {
+final Object unmarshalledObject = jsonb.fromJson("[ \"Test 
String\" ]", (Type) List.class);
+assertEquals(expectedResult, unmarshalledObject);
+}
+}
 
 @Test
 public void boolFromString() {