Pass string to ObjectMapper instead of InputStream (#531)
Pass string to ObjectMapper instead of InputStream in order to avoid No content to map due to end-of-input error caused by jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream. An error was discovered in our customers environmentpull/532/head
parent
aee2079322
commit
c5963e0de7
|
|
@ -116,7 +116,9 @@ public class AzureDevOpsApiClient {
|
|||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -176,7 +176,9 @@ public class HttpBitbucketServerApiClient implements BitbucketServerApiClient {
|
|||
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);
|
||||
}
|
||||
|
|
@ -230,7 +232,9 @@ public class HttpBitbucketServerApiClient implements BitbucketServerApiClient {
|
|||
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);
|
||||
}
|
||||
|
|
@ -271,7 +275,9 @@ public class HttpBitbucketServerApiClient implements BitbucketServerApiClient {
|
|||
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);
|
||||
}
|
||||
|
|
@ -313,7 +319,9 @@ public class HttpBitbucketServerApiClient implements BitbucketServerApiClient {
|
|||
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);
|
||||
}
|
||||
|
|
@ -388,7 +396,9 @@ public class HttpBitbucketServerApiClient implements BitbucketServerApiClient {
|
|||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,7 +108,9 @@ public class BitbucketApiClient {
|
|||
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);
|
||||
}
|
||||
|
|
@ -154,7 +156,9 @@ public class BitbucketApiClient {
|
|||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,7 +111,9 @@ public class GithubApiClient {
|
|||
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);
|
||||
}
|
||||
|
|
@ -140,7 +142,9 @@ public class GithubApiClient {
|
|||
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);
|
||||
}
|
||||
|
|
@ -181,7 +185,9 @@ public class GithubApiClient {
|
|||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,7 +78,9 @@ public class GitlabApiClient {
|
|||
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);
|
||||
}
|
||||
|
|
@ -100,7 +102,9 @@ public class GitlabApiClient {
|
|||
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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue