[ 
https://issues.apache.org/jira/browse/JOHNZON-345?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17361423#comment-17361423
 ] 

Markus Karg commented on JOHNZON-345:
-------------------------------------

Johnzon-1.2.13 throws this exception when running on JSON-P 1.0:
{quote}*java.lang.NoSuchMethodError: 
javax.json.JsonValue.asJsonObject()Ljavax/json/JsonObject;java.lang.NoSuchMethodError:
 javax.json.JsonValue.asJsonObject()Ljavax/json/JsonObject; at 
org.apache.johnzon.jsonb.JsonValueParserAdapter.doCreate(*JsonValueParserAdapter.java:82)
 at 
org.apache.johnzon.jsonb.JsonValueParserAdapter.createFor(JsonValueParserAdapter.java:76)
 at 
org.apache.johnzon.jsonb.JsonbAccessMode$ReaderConverters$1.mapItem(JsonbAccessMode.java:979)
 at 
org.apache.johnzon.jsonb.JsonbAccessMode$ReaderConverters$1.lambda$fromJson$2(JsonbAccessMode.java:969)
 at 
org.apache.johnzon.jsonb.JsonbAccessMode$ReaderConverters$1.fromJson(JsonbAccessMode.java:973)
 at 
org.apache.johnzon.mapper.MappingParserImpl.buildObject(MappingParserImpl.java:365)
 at 
org.apache.johnzon.mapper.MappingParserImpl.readObject(MappingParserImpl.java:151)
 at 
org.apache.johnzon.mapper.MappingParserImpl.readObject(MappingParserImpl.java:140)
 at 
org.apache.johnzon.mapper.MappingParserImpl.readObject(MappingParserImpl.java:134)
 at org.apache.johnzon.mapper.Mapper.mapObject(Mapper.java:385) at 
org.apache.johnzon.mapper.Mapper.readObject(Mapper.java:287) at 
org.apache.johnzon.jsonb.JohnzonJsonb.fromJson(JohnzonJsonb.java:177)
{quote}
 

The reason is that JsonValue::asJsonObject exists since JSON-P 1.1, while 
Payara 4 still uses JSON-P 1.0. *So either that compatibility layer is broken, 
or I need to explicitly enable it somehow?*

> StackOverflow when serializing Collection<URL>
> ----------------------------------------------
>
>                 Key: JOHNZON-345
>                 URL: https://issues.apache.org/jira/browse/JOHNZON-345
>             Project: Johnzon
>          Issue Type: Bug
>          Components: JSON-B
>    Affects Versions: 1.2.11
>            Reporter: Markus Karg
>            Priority: Blocker
>             Fix For: 1.2.12
>
>
> The JSON-B specification mandates that compliant implementations MUST support 
> serialization of Collection and URL.
> Unfortunately when serializing a Collection<URL> using Johnzon-Jsonb 1.2.11 
> an infinite loop happens, resulting in a StackOverflowException.
> I have reproduced this complaint by the following code:
> {{  JsonbConfig jsonbConfig = new JsonbConfig();}}
>  {{  Jsonb jsonb = JsonbBuilder.create(jsonbConfig);}}
>  {{  URL url = new URL("http://www.apache.org";);}}
>  {{  Collection<URL> collection = Collections.singleton(url);}}
>  {{  System.out.println("Jsonb collection: " + jsonb.toJson(collection));}}
> The same problem occurs with Collection<URI>, too.
> Collections in general work fine, i. e. the problem does not occur with e. g. 
> Collection<UUID> or Collection<String>. Also single URL and URIs objects work 
> fine, i. e. when not inside a collection!



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to