jakartaee / jakartaee/jsonp-api

JsonObject's getString() should provide same interface as other getters

Open
#88 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
160
Forks
64
Avg merge
4d 5h
Merged PRs (30d)
4

Description

`JsonObject`'s getters are inconsistent in the interfaces that they provide.

`getString("thing")` throws an exception if the key is missing, all other getters return null.

As a convenience method, `getString()` should provide the same interface as the other getters, which all seem to model `Map.get()` in returning null when the key is missing.

The obvious workaround is to use `getString("thing", null)`. But `getString("thing")` should not be violating the interface provided by all other methods.

Contributor guide

Open the contributing guide

Research direction

Start at the JsonObject getString("thing") entry point and compare its missing-key behavior with the other JsonObject getters. Confirm how the overload accepting a default value behaves. Done means the no-default getString() call returns null for a missing key, matching the other getters and the Map.get() model.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.