aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/bitbucketpullrequestbuilder
diff options
context:
space:
mode:
authorJonathan Brachthäuser <jonathan@b-studios.de>2015-09-03 23:44:28 +0200
committerJonathan Brachthäuser <jonathan@b-studios.de>2015-09-04 11:40:08 +0200
commit733e87f9ce3bd72eab48de2e55b4bb59644c9237 (patch)
treed5c5c8edf32b08f3e4b3ab90bbe4dacd56bb81e2 /src/main/java/bitbucketpullrequestbuilder
parente2b7778e347b787707dfe4dcb46fa7e515dce643 (diff)
downloadbbprb-733e87f9ce3bd72eab48de2e55b4bb59644c9237.tar.gz
:lipstick: Only some cosmetiques
Diffstat (limited to 'src/main/java/bitbucketpullrequestbuilder')
-rw-r--r--src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/ApiClient.java30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/ApiClient.java b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/ApiClient.java
index 173ae1c..713a061 100644
--- a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/ApiClient.java
+++ b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/bitbucket/ApiClient.java
@@ -92,20 +92,21 @@ public class ApiClient {
private HttpClient getHttpClient() {
HttpClient client = new HttpClient();
- if (Jenkins.getInstance() != null) {
- ProxyConfiguration proxy = Jenkins.getInstance().proxy;
- if (proxy != null) {
- logger.info("Jenkins proxy: " + proxy.name + ":" + proxy.port);
- client.getHostConfiguration().setProxy(proxy.name, proxy.port);
- String username = proxy.getUserName();
- String password = proxy.getPassword();
- // Consider it to be passed if username specified. Sufficient?
- if (username != null && !"".equals(username.trim())) {
- logger.info("Using proxy authentication (user=" + username + ")");
- client.getState().setProxyCredentials(AuthScope.ANY,
- new UsernamePasswordCredentials(username, password));
- }
- }
+ if (Jenkins.getInstance() == null) return client;
+
+ ProxyConfiguration proxy = Jenkins.getInstance().proxy;
+ if (proxy == null) return client;
+
+ logger.info("Jenkins proxy: " + proxy.name + ":" + proxy.port);
+ client.getHostConfiguration().setProxy(proxy.name, proxy.port);
+ String username = proxy.getUserName();
+ String password = proxy.getPassword();
+
+ // Consider it to be passed if username specified. Sufficient?
+ if (username != null && !"".equals(username.trim())) {
+ logger.info("Using proxy authentication (user=" + username + ")");
+ client.getState().setProxyCredentials(AuthScope.ANY,
+ new UsernamePasswordCredentials(username, password));
}
return client;
}
@@ -154,4 +155,3 @@ public class ApiClient {
return new ObjectMapper().readValue(response, ref);
}
}
-