Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using static methods instead of deprecated JsonParser #666

Closed
theexplorist opened this issue Apr 14, 2021 · 0 comments · Fixed by #669
Closed

Using static methods instead of deprecated JsonParser #666

theexplorist opened this issue Apr 14, 2021 · 0 comments · Fixed by #669
Assignees

Comments

@theexplorist
Copy link
Contributor

We can remove the deprecated JsonParser with static methods as mentioned in Gson documentation.

The expected result will solve the code smell below -
https://sonarcloud.io/project/issues?id=jkubeio_jkube&open=AXgDJoU2sHuH603U0SQ6&resolved=false&severities=MINOR

Proposed Solution

try(JsonReader json = new JsonReader(new InputStreamReader(stream))) {
            json.setLenient(true);
            while (json.peek() != JsonToken.END_DOCUMENT) {
            	JsonObject jsonObject = JsonParser.parseReader(json).getAsJsonObject();
                handler.process(jsonObject);
            }
        } finally {
            handler.stop();
        }

If the issue and proposed solution seems correct then I can send a PR.

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 a pull request may close this issue.

1 participant