Statement unnecessarily nested within else clause.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1726950 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary D. Gregory 2016-01-27 08:14:03 +00:00
parent 40140009a1
commit 8c840c918b
6 changed files with 36 additions and 51 deletions

View File

@ -109,7 +109,7 @@ public class AuthChallengeParser {
} }
} }
return new AuthChallenge(scheme, null, params.size() > 0 ? params : null); return new AuthChallenge(scheme, null, params.size() > 0 ? params : null);
} else { }
if (params.size() == 1) { if (params.size() == 1) {
final NameValuePair nvp = params.get(0); final NameValuePair nvp = params.get(0);
if (nvp.getValue() == null) { if (nvp.getValue() == null) {
@ -118,6 +118,5 @@ public class AuthChallengeParser {
} }
throw new ParseException("Malformed auth challenge"); throw new ParseException("Malformed auth challenge");
} }
}
} }

View File

@ -89,9 +89,8 @@ public class BasicAuthCache implements AuthCache {
return host; return host;
} }
return new HttpHost(host.getHostName(), port, host.getSchemeName()); return new HttpHost(host.getHostName(), port, host.getSchemeName());
} else {
return host;
} }
return host;
} }
@Override @Override
@ -141,9 +140,8 @@ public class BasicAuthCache implements AuthCache {
} }
return null; return null;
} }
} else {
return null;
} }
return null;
} }
@Override @Override

View File

@ -145,12 +145,11 @@ public class BasicScheme implements AuthScheme, Serializable {
this.username = credentials.getUserPrincipal().getName(); this.username = credentials.getUserPrincipal().getName();
this.password = credentials.getPassword(); this.password = credentials.getPassword();
return true; return true;
} else { }
this.username = null; this.username = null;
this.password = null; this.password = null;
return false; return false;
} }
}
@Override @Override
public Principal getPrincipal() { public Principal getPrincipal() {

View File

@ -160,11 +160,7 @@ public class DigestScheme implements AuthScheme, Serializable {
@Override @Override
public boolean isChallengeComplete() { public boolean isChallengeComplete() {
final String s = this.paramMap.get("stale"); final String s = this.paramMap.get("stale");
if ("true".equalsIgnoreCase(s)) { return "true".equalsIgnoreCase(s) ? false : this.complete;
return false;
} else {
return this.complete;
}
} }
@Override @Override
@ -181,12 +177,11 @@ public class DigestScheme implements AuthScheme, Serializable {
this.username = credentials.getUserPrincipal().getName(); this.username = credentials.getUserPrincipal().getName();
this.password = credentials.getPassword(); this.password = credentials.getPassword();
return true; return true;
} else { }
this.username = null; this.username = null;
this.password = null; this.password = null;
return false; return false;
} }
}
@Override @Override
public Principal getPrincipal() { public Principal getPrincipal() {

View File

@ -105,7 +105,7 @@ public class HttpAuthenticator {
clearCache(host, clientContext); clearCache(host, clientContext);
} }
return true; return true;
} else { }
switch (authExchange.getState()) { switch (authExchange.getState()) {
case CHALLENGED: case CHALLENGED:
case HANDSHAKE: case HANDSHAKE:
@ -120,7 +120,6 @@ public class HttpAuthenticator {
} }
return false; return false;
} }
}
public boolean prepareAuthResponse( public boolean prepareAuthResponse(
final HttpHost host, final HttpHost host,
@ -210,16 +209,14 @@ public class HttpAuthenticator {
authExchange.reset(); authExchange.reset();
authExchange.setState(AuthExchange.State.FAILURE); authExchange.setState(AuthExchange.State.FAILURE);
return false; return false;
} else { }
authExchange.setState(AuthExchange.State.HANDSHAKE); authExchange.setState(AuthExchange.State.HANDSHAKE);
return true; return true;
} }
} else {
authExchange.reset(); authExchange.reset();
// Retry authentication with a different scheme // Retry authentication with a different scheme
} }
} }
}
final List<AuthScheme> preferredSchemes = authStrategy.select(challengeType, challengeMap, context); final List<AuthScheme> preferredSchemes = authStrategy.select(challengeType, challengeMap, context);
final CredentialsProvider credsProvider = clientContext.getCredentialsProvider(); final CredentialsProvider credsProvider = clientContext.getCredentialsProvider();
@ -251,9 +248,8 @@ public class HttpAuthenticator {
authExchange.setState(AuthExchange.State.CHALLENGED); authExchange.setState(AuthExchange.State.CHALLENGED);
authExchange.setOptions(authOptions); authExchange.setOptions(authOptions);
return true; return true;
} else {
return false;
} }
return false;
} }
public void addAuthResponse( public void addAuthResponse(
@ -299,9 +295,8 @@ public class HttpAuthenticator {
} }
} }
return; return;
} else {
Asserts.notNull(authScheme, "AuthScheme");
} }
Asserts.notNull(authScheme, "AuthScheme");
default: default:
} }
if (authScheme != null) { if (authScheme != null) {

View File

@ -133,9 +133,8 @@ public class NTLMScheme implements AuthScheme {
if (credentials instanceof NTCredentials) { if (credentials instanceof NTCredentials) {
this.credentials = (NTCredentials) credentials; this.credentials = (NTCredentials) credentials;
return true; return true;
} else {
return false;
} }
return false;
} }
@Override @Override