aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2019-03-02 17:40:45 +0300
committerIgor Pashev <pashev.igor@gmail.com>2019-03-02 17:40:45 +0300
commitebcc5f3ae97c2428aaff9e6fc27bc590759e23fc (patch)
treea1d3169585cdb95023281e99ab73b233afc20027
parent5dd15063b56f36a6b6df6718e0a01eae0050659d (diff)
downloadbbprb-ebcc5f3ae97c2428aaff9e6fc27bc590759e23fc.tar.gz
Suppress warning on 201 response
-rw-r--r--src/main/java/org/jenkinsci/plugins/bbprb/bitbucket/ApiClient.java13
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);