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

Pass string to ObjectMapper instead of InputStream #531

Merged
merged 1 commit into from
Jul 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ private AzureDevOpsUser getUser(String url, String authorizationHeader)
userDataRequest,
response -> {
try {
return OBJECT_MAPPER.readValue(response.body(), AzureDevOpsUser.class);
String result =
CharStreams.toString(new InputStreamReader(response.body(), Charsets.UTF_8));
return OBJECT_MAPPER.readValue(result, AzureDevOpsUser.class);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,9 @@ public BitbucketUser getUser(String slug, @Nullable String token)
request,
inputStream -> {
try {
return OM.readValue(inputStream, BitbucketUser.class);
String result =
CharStreams.toString(new InputStreamReader(inputStream, Charsets.UTF_8));
return OM.readValue(result, BitbucketUser.class);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
Expand Down Expand Up @@ -230,7 +232,9 @@ public void deletePersonalAccessTokens(String userSlug, Long tokenId)
request,
inputStream -> {
try {
return OM.readValue(inputStream, String.class);
String result =
CharStreams.toString(new InputStreamReader(inputStream, Charsets.UTF_8));
return OM.readValue(result, String.class);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
Expand Down Expand Up @@ -271,7 +275,9 @@ public BitbucketPersonalAccessToken createPersonalAccessTokens(
request,
inputStream -> {
try {
return OM.readValue(inputStream, BitbucketPersonalAccessToken.class);
String result =
CharStreams.toString(new InputStreamReader(inputStream, Charsets.UTF_8));
return OM.readValue(result, BitbucketPersonalAccessToken.class);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
Expand Down Expand Up @@ -313,7 +319,9 @@ public BitbucketPersonalAccessToken getPersonalAccessToken(String userSlug, Long
request,
inputStream -> {
try {
return OM.readValue(inputStream, BitbucketPersonalAccessToken.class);
String result =
CharStreams.toString(new InputStreamReader(inputStream, Charsets.UTF_8));
return OM.readValue(result, BitbucketPersonalAccessToken.class);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
Expand Down Expand Up @@ -388,7 +396,9 @@ private <T> Page<T> doGetPage(Class<T> tClass, String api, int start, int limit,
request,
inputStream -> {
try {
return OM.readValue(inputStream, typeReference);
String result =
CharStreams.toString(new InputStreamReader(inputStream, Charsets.UTF_8));
return OM.readValue(result, typeReference);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ public BitbucketUser getUser(String authenticationToken)
request,
response -> {
try {
return OBJECT_MAPPER.readValue(response.body(), BitbucketUser.class);
String result =
CharStreams.toString(new InputStreamReader(response.body(), Charsets.UTF_8));
return OBJECT_MAPPER.readValue(result, BitbucketUser.class);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
Expand Down Expand Up @@ -154,7 +156,9 @@ public BitbucketUserEmail getEmail(String authenticationToken)
request,
response -> {
try {
return OBJECT_MAPPER.readValue(response.body(), BitbucketUserEmail.class);
String result =
CharStreams.toString(new InputStreamReader(response.body(), Charsets.UTF_8));
return OBJECT_MAPPER.readValue(result, BitbucketUserEmail.class);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ public GithubUser getUser(String authenticationToken)
request,
response -> {
try {
return OBJECT_MAPPER.readValue(response.body(), GithubUser.class);
String result =
CharStreams.toString(new InputStreamReader(response.body(), Charsets.UTF_8));
return OBJECT_MAPPER.readValue(result, GithubUser.class);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
Expand Down Expand Up @@ -140,7 +142,9 @@ public GithubPullRequest getPullRequest(
request,
response -> {
try {
return OBJECT_MAPPER.readValue(response.body(), GithubPullRequest.class);
String result =
CharStreams.toString(new InputStreamReader(response.body(), Charsets.UTF_8));
return OBJECT_MAPPER.readValue(result, GithubPullRequest.class);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
Expand Down Expand Up @@ -181,7 +185,9 @@ public GithubCommit getLatestCommit(
request,
response -> {
try {
return OBJECT_MAPPER.readValue(response.body(), GithubCommit[].class)[0];
String result =
CharStreams.toString(new InputStreamReader(response.body(), Charsets.UTF_8));
return OBJECT_MAPPER.readValue(result, GithubCommit[].class)[0];
} catch (IOException e) {
throw new UncheckedIOException(e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ public GitlabUser getUser(String authenticationToken)
request,
inputStream -> {
try {
return OBJECT_MAPPER.readValue(inputStream, GitlabUser.class);
String result =
CharStreams.toString(new InputStreamReader(inputStream, Charsets.UTF_8));
return OBJECT_MAPPER.readValue(result, GitlabUser.class);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
Expand All @@ -100,7 +102,9 @@ public GitlabOauthTokenInfo getTokenInfo(String authenticationToken)
request,
inputStream -> {
try {
return OBJECT_MAPPER.readValue(inputStream, GitlabOauthTokenInfo.class);
String result =
CharStreams.toString(new InputStreamReader(inputStream, Charsets.UTF_8));
return OBJECT_MAPPER.readValue(result, GitlabOauthTokenInfo.class);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
Expand Down