diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2013-12-09 22:02:28 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2013-12-09 22:02:28 +0100 |
commit | f0cbff8e9697dd5cb4999eee5e6f92871eacdfe2 (patch) | |
tree | 300024d21d9653b784d0eca86d9b818631f3612e /sonar-ws-client/src/main/java | |
parent | 9b8d4d064f0c719ae1a96fc2140912a90b367706 (diff) | |
download | sonarqube-f0cbff8e9697dd5cb4999eee5e6f92871eacdfe2.tar.gz sonarqube-f0cbff8e9697dd5cb4999eee5e6f92871eacdfe2.zip |
Fix some quality flaws
Diffstat (limited to 'sonar-ws-client/src/main/java')
-rw-r--r-- | sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/HttpClient4Connector.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/HttpClient4Connector.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/HttpClient4Connector.java index d82e6b80ac3..a61ec552346 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/HttpClient4Connector.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/connectors/HttpClient4Connector.java @@ -146,7 +146,7 @@ public class HttpClient4Connector extends Connector { // Generate BASIC scheme object and stick it to the local // execution context BasicScheme basicAuth = new BasicScheme(); - localcontext.setAttribute("preemptive-auth", basicAuth); + localcontext.setAttribute(PreemptiveAuth.ATTRIBUTE, basicAuth); // Add as the first request interceptor client.addRequestInterceptor(new PreemptiveAuth(), 0); @@ -200,6 +200,9 @@ public class HttpClient4Connector extends Connector { } static final class PreemptiveAuth implements HttpRequestInterceptor { + + static final String ATTRIBUTE = "preemptive-auth"; + public void process( final HttpRequest request, final HttpContext context) throws HttpException { @@ -208,7 +211,7 @@ public class HttpClient4Connector extends Connector { // If no auth scheme available yet, try to initialize it preemptively if (authState.getAuthScheme() == null) { - AuthScheme authScheme = (AuthScheme) context.getAttribute("preemptive-auth"); + AuthScheme authScheme = (AuthScheme) context.getAttribute(ATTRIBUTE); CredentialsProvider credsProvider = (CredentialsProvider) context.getAttribute(ClientContext.CREDS_PROVIDER); HttpHost targetHost = (HttpHost) context.getAttribute(ExecutionContext.HTTP_TARGET_HOST); if (authScheme != null) { |