Skip to content

Conversation

@mkarg
Copy link

@mkarg mkarg commented Sep 22, 2019

  • The JSON-P API requires JsonObject.getString("missing") to throw NullPointerException for non-existent key "missing".
  • Geronimo's variant of the JSON-P API (EmptyJsonObject) incorrectly returns null instead of throwing an exception.
  • The JSON-P API requires JsonObject.getString("missing", "default") to return "default" for non-existent key "missing".
  • Geronimo's variant of the JSON-P API (EmptyJsonObject) incorrectly returns null instead of "default".
  • The JSON-P API requires JsonObject.isNull("missing") to throw NullPointerException for non-existent key "missing".
  • Geronimo's variant of the JSON-P API (EmptyJsonObject) incorrectly returns true instead of throwing an exception.

…swers getString and isNull

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"`.
[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.
 

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"`.
[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"`.
 

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"`.
[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.
 

Signed-off-by: Markus KARG <markus@headcrashing.eu>
@mkarg
Copy link
Author

mkarg commented Sep 22, 2019

See Apache Geronimo Bug Report.

@rmannibucau
Copy link
Contributor

applied (manually since spec are still on svn), thanks a lot for the PR @mkarg

@mkarg
Copy link
Author

mkarg commented Sep 23, 2019

You're welcome. Unfortunately the -source and -javadoc JARs are missing in the Apache Repository for 1.3-SNAPSHOT.

@rmannibucau
Copy link
Contributor

just redeployed them

@mkarg
Copy link
Author

mkarg commented Sep 23, 2019

Works fine now, thanks a lot! :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants