Skip to content
Permalink
Browse files

44: GitHubApplication should not use a JSONParser instance

Reviewed-by: rwestberg
  • Loading branch information
Erik Helin
Erik Helin committed Jul 5, 2019
1 parent 90edbab commit 6746b0397966c9a55a416f74d6301bb262e12626
@@ -97,7 +97,6 @@ public String toString() {
private final Token installationToken;

private final Logger log;
private final JSONParser jsonParser;

static class GitHubConfigurationError extends RuntimeException {
public GitHubConfigurationError(String message) {
@@ -108,7 +107,6 @@ public GitHubConfigurationError(String message) {
public GitHubApplication(String keyFile, String issue, String id) {

log = Logger.getLogger("org.openjdk.host.github");
jsonParser = new JSONParser();

apiBase = URIBuilder.base("https://api.github.com/").build();
this.issue = issue;
@@ -194,7 +192,7 @@ private String generateInstallationToken() throws Token.GeneratorError {
HttpResponse.BodyHandlers.ofString()
);

var data = jsonParser.parse(response.body());
var data = JSON.parse(response.body());
if (!data.contains("token")) {
throw new Token.GeneratorError("Unknown data returned: " + data);
}
@@ -228,7 +226,7 @@ JSONObject getAppDetails() {
HttpResponse.BodyHandlers.ofString()
);

var data = jsonParser.parse(response.body());
var data = JSON.parse(response.body());
return data.asObject();
} catch (IOException e) {
throw new UncheckedIOException(e);
@@ -24,11 +24,11 @@

import java.util.*;

public class JSONParser {
class JSONParser {
private int pos = 0;
private String input;

public JSONParser() {
JSONParser() {
}

private IllegalStateException failure(String message) {

0 comments on commit 6746b03

Please sign in to comment.
You can’t perform that action at this time.