diff options
Diffstat (limited to 'src/main/java/org')
-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); |