johnzon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [johnzon] mkarg commented on issue #46: [JOHNZON-278] Return constant instead of new instance of empty block / empty array
Date Sun, 22 Sep 2019 10:48:26 GMT
mkarg commented on issue #46: [JOHNZON-278] Return constant instead of new instance of empty
block / empty array
URL: https://github.com/apache/johnzon/pull/46#issuecomment-533870565
 
 
   > @mkarg can you detail the geronimo issue?
   
   **`JsonObjectImplTest.testGetStringMissingKeyShouldThrowNullPointerException Expected exception:
java.lang.NullPointerException`:**
   * The [JSON-P API](https://github.com/eclipse-ee4j/jsonp/blob/5735bb62715578633d5721bf583b837506bbec73/api/src/main/java/javax/json/JsonObject.java#L164-L165)
requires `JsonObject.getString("missing")` to throw `NullPointerException` for non-existent
key `"missing"`.
   * [Johnzon Core](https://github.com/apache/johnzon/blob/589fb9e2b8732a0033f99d162b1209082d0de019/johnzon-core/src/test/java/org/apache/johnzon/core/JsonObjectImplTest.java#L138-L141)'s
`JsonObjectImplTest` *correctly* tests this behavior.
   * [Jakarta](https://github.com/eclipse-ee4j/jsonp/blob/5735bb62715578633d5721bf583b837506bbec73/api/src/main/java/javax/json/EmptyObject.java#L58-L61)'s
original JSON-P API (`EmptyObject`) *correctly* throws `NullPointerException` .
   * [Geronimo](https://github.com/apache/geronimo-specs/blob/0f0956795ad0839ec698e11fd3a7049f0114623c/geronimo-json_1.1_spec/src/main/java/javax/json/EmptyJsonObject.java#L51-L52)'s
variant of the JSON-P API (`EmptyJsonObject`) **incorrectly** returns `null` instead of throwing
an exception.
   
   **`JsonObjectImplTest.testGetStringWithDefaultShouldReturnDefault:146 expected:<default>
but was:<null>`:**
   * The [JSON-P API](https://github.com/eclipse-ee4j/jsonp/blob/5735bb62715578633d5721bf583b837506bbec73/api/src/main/java/javax/json/JsonObject.java#L172-L175)
requires `JsonObject.getString("missing", "default")` to return `"default"` for non-existent
key `"missing"`.
   * [Johnzon Core](https://github.com/apache/johnzon/blob/589fb9e2b8732a0033f99d162b1209082d0de019/johnzon-core/src/test/java/org/apache/johnzon/core/JsonObjectImplTest.java#L143-L147)'s
`JsonObjectImplTest` *correctly* tests this behavior.
   * [Jakarta](https://github.com/eclipse-ee4j/jsonp/blob/5735bb62715578633d5721bf583b837506bbec73/api/src/main/java/javax/json/EmptyObject.java#L63-L66)'s
original JSON-P API (`EmptyObject`) *correctly* returns `"default"`.
   * [Geronimo](https://github.com/apache/geronimo-specs/blob/0f0956795ad0839ec698e11fd3a7049f0114623c/geronimo-json_1.1_spec/src/main/java/javax/json/EmptyJsonObject.java#L55-L58)'s
variant of the JSON-P API (`EmptyJsonObject`) **incorrectly** returns `null` instead of `"default"`.
   
   **`JsonObjectImplTest.testIsNullMissingKeyShouldThrowNullPointerException Expected exception:
java.lang.NullPointerException`:**
   * The [JSON-P API](https://github.com/eclipse-ee4j/jsonp/blob/5735bb62715578633d5721bf583b837506bbec73/api/src/main/java/javax/json/JsonObject.java#L244-L245)
requires `JsonObject.isNull("missing")` to throw `NullPointerException` for non-existent key
`"missing"`.
   * [Johnzon Core](https://github.com/apache/johnzon/blob/589fb9e2b8732a0033f99d162b1209082d0de019/johnzon-core/src/test/java/org/apache/johnzon/core/JsonObjectImplTest.java#L150-L153)'s
`JsonObjectImplTest` *correctly* tests this behavior.
   * [Jakarta](https://github.com/eclipse-ee4j/jsonp/blob/5735bb62715578633d5721bf583b837506bbec73/api/src/main/java/javax/json/EmptyObject.java#L88-L91)'s
original JSON-P API (`EmptyObject`) *correctly* throws `NullPointerException`.
   * [Geronimo](https://github.com/apache/geronimo-specs/blob/0f0956795ad0839ec698e11fd3a7049f0114623c/geronimo-json_1.1_spec/src/main/java/javax/json/EmptyJsonObject.java#L80-L83)'s
variant of the JSON-P API (`EmptyJsonObject`) **incorrectly** returns `true` instead of throwing
an exception.
   
   As a result the Johnzon tests fail when runnign against Geronimo's variant of JSON-P API
while it passes when running against Jakarta's original JSON-P API.
   
   A short term solution could be to *temporarily* switch from Geronimo to Jakarta until Geronimo
published a fix for their variant of the JSON-P API.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message