diff options
author | Daniel Fly <dn@smartweb.dk> | 2017-06-26 13:59:50 +0200 |
---|---|---|
committer | Daniel Fly <dn@smartweb.dk> | 2017-06-26 13:59:50 +0200 |
commit | ee9994e91c5aad01c754250c16b890b583d3b8b2 (patch) | |
tree | 044dcf781e4d5094f5ca07bf8cbb85eb95263c80 /src/main/java | |
parent | 1169c952a49d5b2d4260863397b2055893e7a11b (diff) | |
download | bbprb-ee9994e91c5aad01c754250c16b890b583d3b8b2.tar.gz |
Fixed NPE
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/ApiClient.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/ApiClient.java b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/ApiClient.java index cf3675c..0c21806 100644 --- a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/ApiClient.java +++ b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/ApiClient.java @@ -142,7 +142,8 @@ public class ApiClient { public boolean hasBuildStatus(String owner, String repositoryName, String revision, String keyEx) { String url = v2(owner, repositoryName, "/commit/" + revision + "/statuses/build/" + this.computeAPIKey(keyEx)); - return get(url).contains("\"state\""); + String reqBody = get(url); + return reqBody != null && reqBody.contains("\"state\""); } public void setBuildStatus(String owner, String repositoryName, String revision, BuildState state, String buildUrl, String comment, String keyEx) { @@ -258,7 +259,7 @@ public class ApiClient { try { int statusCode = client.executeMethod(req); if (statusCode != HttpStatus.SC_OK) { - logger.log(Level.WARNING, "Response code failed: " + req.getStatusLine()); + logger.log(Level.WARNING, "Response status: " + req.getStatusLine()+" URI: "+req.getURI()); }else{ return req.getResponseBodyAsString(); } |