diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2019-03-02 17:40:45 +0300 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2019-03-02 17:40:45 +0300 |
commit | ebcc5f3ae97c2428aaff9e6fc27bc590759e23fc (patch) | |
tree | a1d3169585cdb95023281e99ab73b233afc20027 /src | |
parent | 5dd15063b56f36a6b6df6718e0a01eae0050659d (diff) | |
download | bbprb-ebcc5f3ae97c2428aaff9e6fc27bc590759e23fc.tar.gz |
Suppress warning on 201 response
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/jenkinsci/plugins/bbprb/bitbucket/ApiClient.java | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/main/java/org/jenkinsci/plugins/bbprb/bitbucket/ApiClient.java b/src/main/java/org/jenkinsci/plugins/bbprb/bitbucket/ApiClient.java index 721e038..1d466a4 100644 --- a/src/main/java/org/jenkinsci/plugins/bbprb/bitbucket/ApiClient.java +++ b/src/main/java/org/jenkinsci/plugins/bbprb/bitbucket/ApiClient.java @@ -170,11 +170,14 @@ public class ApiClient { client.getParams().setAuthenticationPreemptive(true); try { int statusCode = client.executeMethod(req); - if (statusCode != HttpStatus.SC_OK) { - logger.log(Level.WARNING, "Response status: " + req.getStatusLine() + - " URI: " + req.getURI()); - } else { - return req.getResponseBodyAsString(); + switch (statusCode) { + case HttpStatus.SC_OK: + return req.getResponseBodyAsString(); + case HttpStatus.SC_CREATED: + break; + default: + logger.log(Level.WARNING, "Response status: " + req.getStatusLine() + + " URI: " + req.getURI()); } } catch (HttpException e) { logger.log(Level.WARNING, "Failed to send request.", e); |