in commit-status-publisher-server/src/main/java/jetbrains/buildServer/commitPublisher/github/api/impl/GitHubApiImpl.java [431:465]
public void postComment(@NotNull final String ownerName,
@NotNull final String repoName,
@NotNull final String hash,
@NotNull final String comment) throws IOException {
final String url = myUrls.getAddCommentUrl(ownerName, repoName, hash);
final String entity = myGson.toJson(new IssueComment(comment));
final HttpMethod method = HttpMethod.POST;
LoggerUtil.logRequest(Constants.GITHUB_PUBLISHER_ID, method, url, entity);
final AtomicReference<Exception> exceptionRef = new AtomicReference<>();
IOGuard.allowNetworkCall(() -> {
myClient.post(
url, authenticationCredentials(), defaultHeaders(),
entity, ContentType.APPLICATION_JSON.getMimeType(), ContentType.APPLICATION_JSON.getCharset(),
response -> {
},
response -> {
String responseBody = logFailedResponse(method, url, entity, response);
String githubError = parseErrorsFromResponse(responseBody);
exceptionRef.set(new IOException(getErrorMessage(response, githubError)));
},
e -> exceptionRef.set(e));
});
final Exception ex;
if ((ex = exceptionRef.get()) != null) {
if (ex instanceof IOException) {
throw (IOException) ex;
} else {
throw new IOException(ex);
}
}
}