GERONIMO-6751 JSON-P 1.1 incompliance: EmptyJsonObject incorrectly an…#15
Open
mkarg wants to merge 1 commit intoapache:trunkfrom
Open
GERONIMO-6751 JSON-P 1.1 incompliance: EmptyJsonObject incorrectly an…#15mkarg wants to merge 1 commit intoapache:trunkfrom
mkarg wants to merge 1 commit intoapache:trunkfrom
Conversation
…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>
Author
Contributor
|
applied (manually since spec are still on svn), thanks a lot for the PR @mkarg |
Author
|
You're welcome. Unfortunately the |
Contributor
|
just redeployed them |
Author
|
Works fine now, thanks a lot! :-) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
JsonObject.getString("missing")to throwNullPointerExceptionfor non-existent key"missing".EmptyJsonObject) incorrectly returnsnullinstead of throwing an exception.JsonObject.getString("missing", "default")to return"default"for non-existent key"missing".EmptyJsonObject) incorrectly returnsnullinstead of"default".JsonObject.isNull("missing")to throwNullPointerExceptionfor non-existent key"missing".EmptyJsonObject) incorrectly returnstrueinstead of throwing an exception.