"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "httpclient5/src/main/java/org/apache/hc/client5/http/auth/AuthScope.java" between
httpcomponents-client-5.2-src.tar.gz and httpcomponents-client-5.2.1-src.tar.gz

About: Apache HttpComponents Client provides reusable components for client-side authentication, HTTP state management, and HTTP connection management. Java sources.

AuthScope.java  (httpcomponents-client-5.2-src):AuthScope.java  (httpcomponents-client-5.2.1-src)
skipping to change at line 30 skipping to change at line 30
* *
* This software consists of voluntary contributions made by many * This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more * individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see * information on the Apache Software Foundation, please see
* <http://www.apache.org/>. * <http://www.apache.org/>.
* *
*/ */
package org.apache.hc.client5.http.auth; package org.apache.hc.client5.http.auth;
import java.util.Locale; import java.util.Locale;
import java.util.Objects;
import org.apache.hc.core5.annotation.Contract; import org.apache.hc.core5.annotation.Contract;
import org.apache.hc.core5.annotation.ThreadingBehavior; import org.apache.hc.core5.annotation.ThreadingBehavior;
import org.apache.hc.core5.http.HttpHost; import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.util.Args; import org.apache.hc.core5.util.Args;
import org.apache.hc.core5.util.LangUtils; import org.apache.hc.core5.util.LangUtils;
/** /**
* {@code AuthScope} represents an authentication scope consisting of * {@code AuthScope} represents an authentication scope consisting of
* an application protocol, a host name, a port number, a realm name * an application protocol, a host name, a port number, a realm name
skipping to change at line 169 skipping to change at line 170
/** /**
* Tests if the authentication scopes match. * Tests if the authentication scopes match.
* *
* @return the match factor. Negative value signifies no match. * @return the match factor. Negative value signifies no match.
* Non-negative signifies a match. The greater the returned value * Non-negative signifies a match. The greater the returned value
* the closer the match. * the closer the match.
*/ */
public int match(final AuthScope that) { public int match(final AuthScope that) {
int factor = 0; int factor = 0;
if (LangUtils.equals(toNullSafeLowerCase(this.schemeName), if (Objects.equals(toNullSafeLowerCase(this.schemeName),
toNullSafeLowerCase(that.schemeName))) { toNullSafeLowerCase(that.schemeName))) {
factor += 1; factor += 1;
} else { } else {
if (this.schemeName != null && that.schemeName != null) { if (this.schemeName != null && that.schemeName != null) {
return -1; return -1;
} }
} }
if (LangUtils.equals(this.realm, that.realm)) { if (Objects.equals(this.realm, that.realm)) {
factor += 2; factor += 2;
} else { } else {
if (this.realm != null && that.realm != null) { if (this.realm != null && that.realm != null) {
return -1; return -1;
} }
} }
if (this.port == that.port) { if (this.port == that.port) {
factor += 4; factor += 4;
} else { } else {
if (this.port != -1 && that.port != -1) { if (this.port != -1 && that.port != -1) {
return -1; return -1;
} }
} }
if (LangUtils.equals(this.protocol, that.protocol)) { if (Objects.equals(this.protocol, that.protocol)) {
factor += 8; factor += 8;
} else { } else {
if (this.protocol != null && that.protocol != null) { if (this.protocol != null && that.protocol != null) {
return -1; return -1;
} }
} }
if (LangUtils.equals(this.host, that.host)) { if (Objects.equals(this.host, that.host)) {
factor += 16; factor += 16;
} else { } else {
if (this.host != null && that.host != null) { if (this.host != null && that.host != null) {
return -1; return -1;
} }
} }
return factor; return factor;
} }
@Override @Override
public boolean equals(final Object obj) { public boolean equals(final Object obj) {
if (this == obj) { if (this == obj) {
return true; return true;
} }
if (obj instanceof AuthScope) { if (obj instanceof AuthScope) {
final AuthScope that = (AuthScope) obj; final AuthScope that = (AuthScope) obj;
return LangUtils.equals(this.protocol, that.protocol) return Objects.equals(this.protocol, that.protocol)
&& LangUtils.equals(this.host, that.host) && Objects.equals(this.host, that.host)
&& this.port == that.port && this.port == that.port
&& LangUtils.equals(this.realm, that.realm) && Objects.equals(this.realm, that.realm)
&& LangUtils.equals(toNullSafeLowerCase(this.schemeName), && Objects.equals(toNullSafeLowerCase(this.schemeName),
toNullSafeLowerCase(that.schemeName)); toNullSafeLowerCase(that.schemeName));
} }
return false; return false;
} }
@Override @Override
public int hashCode() { public int hashCode() {
int hash = LangUtils.HASH_SEED; int hash = LangUtils.HASH_SEED;
hash = LangUtils.hashCode(hash, this.protocol); hash = LangUtils.hashCode(hash, this.protocol);
hash = LangUtils.hashCode(hash, this.host); hash = LangUtils.hashCode(hash, this.host);
 End of changes. 7 change blocks. 
8 lines changed or deleted 9 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)