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:
parent
40140009a1
commit
8c840c918b
|
@ -109,15 +109,14 @@ public class AuthChallengeParser {
|
|||
}
|
||||
}
|
||||
return new AuthChallenge(scheme, null, params.size() > 0 ? params : null);
|
||||
} else {
|
||||
if (params.size() == 1) {
|
||||
final NameValuePair nvp = params.get(0);
|
||||
if (nvp.getValue() == null) {
|
||||
return new AuthChallenge(nvp.getName(), null, null);
|
||||
}
|
||||
}
|
||||
throw new ParseException("Malformed auth challenge");
|
||||
}
|
||||
if (params.size() == 1) {
|
||||
final NameValuePair nvp = params.get(0);
|
||||
if (nvp.getValue() == null) {
|
||||
return new AuthChallenge(nvp.getName(), null, null);
|
||||
}
|
||||
}
|
||||
throw new ParseException("Malformed auth challenge");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -89,9 +89,8 @@ public class BasicAuthCache implements AuthCache {
|
|||
return host;
|
||||
}
|
||||
return new HttpHost(host.getHostName(), port, host.getSchemeName());
|
||||
} else {
|
||||
return host;
|
||||
}
|
||||
return host;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -141,9 +140,8 @@ public class BasicAuthCache implements AuthCache {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -145,11 +145,10 @@ public class BasicScheme implements AuthScheme, Serializable {
|
|||
this.username = credentials.getUserPrincipal().getName();
|
||||
this.password = credentials.getPassword();
|
||||
return true;
|
||||
} else {
|
||||
this.username = null;
|
||||
this.password = null;
|
||||
return false;
|
||||
}
|
||||
this.username = null;
|
||||
this.password = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -160,11 +160,7 @@ public class DigestScheme implements AuthScheme, Serializable {
|
|||
@Override
|
||||
public boolean isChallengeComplete() {
|
||||
final String s = this.paramMap.get("stale");
|
||||
if ("true".equalsIgnoreCase(s)) {
|
||||
return false;
|
||||
} else {
|
||||
return this.complete;
|
||||
}
|
||||
return "true".equalsIgnoreCase(s) ? false : this.complete;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -181,11 +177,10 @@ public class DigestScheme implements AuthScheme, Serializable {
|
|||
this.username = credentials.getUserPrincipal().getName();
|
||||
this.password = credentials.getPassword();
|
||||
return true;
|
||||
} else {
|
||||
this.username = null;
|
||||
this.password = null;
|
||||
return false;
|
||||
}
|
||||
this.username = null;
|
||||
this.password = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -105,21 +105,20 @@ public class HttpAuthenticator {
|
|||
clearCache(host, clientContext);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
switch (authExchange.getState()) {
|
||||
case CHALLENGED:
|
||||
case HANDSHAKE:
|
||||
this.log.debug("Authentication succeeded");
|
||||
authExchange.setState(AuthExchange.State.SUCCESS);
|
||||
updateCache(host, authExchange.getAuthScheme(), clientContext);
|
||||
break;
|
||||
case SUCCESS:
|
||||
break;
|
||||
default:
|
||||
authExchange.setState(AuthExchange.State.UNCHALLENGED);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
switch (authExchange.getState()) {
|
||||
case CHALLENGED:
|
||||
case HANDSHAKE:
|
||||
this.log.debug("Authentication succeeded");
|
||||
authExchange.setState(AuthExchange.State.SUCCESS);
|
||||
updateCache(host, authExchange.getAuthScheme(), clientContext);
|
||||
break;
|
||||
case SUCCESS:
|
||||
break;
|
||||
default:
|
||||
authExchange.setState(AuthExchange.State.UNCHALLENGED);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean prepareAuthResponse(
|
||||
|
@ -210,14 +209,12 @@ public class HttpAuthenticator {
|
|||
authExchange.reset();
|
||||
authExchange.setState(AuthExchange.State.FAILURE);
|
||||
return false;
|
||||
} else {
|
||||
authExchange.setState(AuthExchange.State.HANDSHAKE);
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
authExchange.reset();
|
||||
// Retry authentication with a different scheme
|
||||
authExchange.setState(AuthExchange.State.HANDSHAKE);
|
||||
return true;
|
||||
}
|
||||
authExchange.reset();
|
||||
// Retry authentication with a different scheme
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -251,9 +248,8 @@ public class HttpAuthenticator {
|
|||
authExchange.setState(AuthExchange.State.CHALLENGED);
|
||||
authExchange.setOptions(authOptions);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void addAuthResponse(
|
||||
|
@ -299,9 +295,8 @@ public class HttpAuthenticator {
|
|||
}
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
Asserts.notNull(authScheme, "AuthScheme");
|
||||
}
|
||||
Asserts.notNull(authScheme, "AuthScheme");
|
||||
default:
|
||||
}
|
||||
if (authScheme != null) {
|
||||
|
|
|
@ -133,9 +133,8 @@ public class NTLMScheme implements AuthScheme {
|
|||
if (credentials instanceof NTCredentials) {
|
||||
this.credentials = (NTCredentials) credentials;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue