From ebcc5f3ae97c2428aaff9e6fc27bc590759e23fc Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Sat, 2 Mar 2019 17:40:45 +0300 Subject: Suppress warning on 201 response --- .../org/jenkinsci/plugins/bbprb/bitbucket/ApiClient.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/main/java/org/jenkinsci') 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); -- cgit v1.2.3