Skip to content
This repository was archived by the owner on Jun 9, 2021. It is now read-only.

Commit 12f2257

Browse files
committed
Avoiding trying to read empty responses from notifications #194
1 parent 6b8832e commit 12f2257

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,12 @@ Changelog of Pull Request Notifier for Bitbucket.
2323
* PULL_REQUEST_REVIEWERS_NEEDS_WORK_EMAIL
2424
* PULL_REQUEST_REVIEWERS_NEEDS_WORK_NAME
2525

26-
[72607d4617b0e7d](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/72607d4617b0e7d) Tomas Bjerre *2017-02-01 19:16:26*
26+
[6b8832e587d55b0](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/6b8832e587d55b0) Tomas Bjerre *2017-02-01 19:23:38*
27+
28+
### GitHub [#194](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/issues/194) Pull Request activity throws IllegalArgumentException
29+
Avoiding trying to read empty responses from notifications
30+
31+
[6723e59c0b892d0](https://github.com/tomasbjerre/pull-request-notifier-for-bitbucket/commit/6723e59c0b892d0) Tomas Bjerre *2017-02-01 19:29:09*
2732

2833
### No issue
2934
doc

src/main/java/se/bjurr/prnfb/http/UrlInvoker.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@
4646
import org.apache.http.util.EntityUtils;
4747
import org.slf4j.Logger;
4848

49-
import se.bjurr.prnfb.settings.PrnfbHeader;
50-
import se.bjurr.prnfb.settings.PrnfbNotification;
51-
5249
import com.google.common.annotations.VisibleForTesting;
5350
import com.google.common.base.Optional;
5451

52+
import se.bjurr.prnfb.settings.PrnfbHeader;
53+
import se.bjurr.prnfb.settings.PrnfbNotification;
54+
5555
/**
5656
* If told to accept all certificates, an unsafe X509 trust manager is used.<br>
5757
* <br>
@@ -352,10 +352,13 @@ HttpResponse doInvoke(HttpRequestBase httpRequestBase, HttpClientBuilder builder
352352
.execute(httpRequestBase);
353353

354354
HttpEntity entity = httpResponse.getEntity();
355-
return new HttpResponse(
356-
httpRequestBase.getURI(),
357-
httpResponse.getStatusLine().getStatusCode(),
358-
EntityUtils.toString(entity, UTF_8));
355+
String entityString = "";
356+
if (entity != null) {
357+
entityString = EntityUtils.toString(entity, UTF_8);
358+
}
359+
URI uri = httpRequestBase.getURI();
360+
int statusCode = httpResponse.getStatusLine().getStatusCode();
361+
return new HttpResponse(uri, statusCode, entityString);
359362
} catch (final Exception e) {
360363
LOG.error("", e);
361364
} finally {

0 commit comments

Comments
 (0)