diff --git a/httpclient/src/main/java/org/apache/http/auth/AUTH.java b/httpclient/src/main/java/org/apache/http/auth/AUTH.java index 0c68cffa3..e36989026 100644 --- a/httpclient/src/main/java/org/apache/http/auth/AUTH.java +++ b/httpclient/src/main/java/org/apache/http/auth/AUTH.java @@ -31,12 +31,15 @@ package org.apache.http.auth; +import net.jcip.annotations.Immutable; + /** * Constants and static helpers related to the HTTP authentication. * * * @since 4.0 */ +@Immutable public final class AUTH { /** diff --git a/httpclient/src/main/java/org/apache/http/auth/AuthSchemeRegistry.java b/httpclient/src/main/java/org/apache/http/auth/AuthSchemeRegistry.java index 12ce45621..bb8983865 100644 --- a/httpclient/src/main/java/org/apache/http/auth/AuthSchemeRegistry.java +++ b/httpclient/src/main/java/org/apache/http/auth/AuthSchemeRegistry.java @@ -36,6 +36,9 @@ import java.util.List; import java.util.Locale; import java.util.Map; +import net.jcip.annotations.GuardedBy; +import net.jcip.annotations.ThreadSafe; + import org.apache.http.params.HttpParams; /** @@ -47,8 +50,10 @@ import org.apache.http.params.HttpParams; * @version $Revision$ * @since 4.0 */ +@ThreadSafe public final class AuthSchemeRegistry { + @GuardedBy("this") private final Map registeredSchemes; public AuthSchemeRegistry() { diff --git a/httpclient/src/main/java/org/apache/http/auth/AuthScope.java b/httpclient/src/main/java/org/apache/http/auth/AuthScope.java index 5eb6a4de8..c71c8bce0 100644 --- a/httpclient/src/main/java/org/apache/http/auth/AuthScope.java +++ b/httpclient/src/main/java/org/apache/http/auth/AuthScope.java @@ -32,6 +32,8 @@ package org.apache.http.auth; import java.util.Locale; +import net.jcip.annotations.Immutable; + import org.apache.http.util.LangUtils; /** @@ -42,6 +44,7 @@ import org.apache.http.util.LangUtils; * * @since 4.0 */ +@Immutable public class AuthScope { /** diff --git a/httpclient/src/main/java/org/apache/http/auth/AuthState.java b/httpclient/src/main/java/org/apache/http/auth/AuthState.java index 5a848a6a0..70bdcc3f9 100644 --- a/httpclient/src/main/java/org/apache/http/auth/AuthState.java +++ b/httpclient/src/main/java/org/apache/http/auth/AuthState.java @@ -30,6 +30,8 @@ package org.apache.http.auth; +import net.jcip.annotations.NotThreadSafe; + /** * This class provides detailed information about the state of the @@ -38,6 +40,7 @@ package org.apache.http.auth; * * @since 4.0 */ +@NotThreadSafe public class AuthState { /** Actual authentication scheme */ diff --git a/httpclient/src/main/java/org/apache/http/auth/AuthenticationException.java b/httpclient/src/main/java/org/apache/http/auth/AuthenticationException.java index 0c437176b..b3d9bfed9 100644 --- a/httpclient/src/main/java/org/apache/http/auth/AuthenticationException.java +++ b/httpclient/src/main/java/org/apache/http/auth/AuthenticationException.java @@ -30,6 +30,8 @@ package org.apache.http.auth; +import net.jcip.annotations.Immutable; + import org.apache.http.ProtocolException; /** @@ -38,6 +40,7 @@ import org.apache.http.ProtocolException; * * @since 4.0 */ +@Immutable public class AuthenticationException extends ProtocolException { private static final long serialVersionUID = -6794031905674764776L; diff --git a/httpclient/src/main/java/org/apache/http/auth/BasicUserPrincipal.java b/httpclient/src/main/java/org/apache/http/auth/BasicUserPrincipal.java index 92c49aaea..6f7c7a11e 100644 --- a/httpclient/src/main/java/org/apache/http/auth/BasicUserPrincipal.java +++ b/httpclient/src/main/java/org/apache/http/auth/BasicUserPrincipal.java @@ -32,6 +32,8 @@ package org.apache.http.auth; import java.security.Principal; +import net.jcip.annotations.Immutable; + import org.apache.http.util.LangUtils; /** @@ -40,6 +42,7 @@ import org.apache.http.util.LangUtils; * * @since 4.0 */ +@Immutable public final class BasicUserPrincipal implements Principal { private final String username; diff --git a/httpclient/src/main/java/org/apache/http/auth/InvalidCredentialsException.java b/httpclient/src/main/java/org/apache/http/auth/InvalidCredentialsException.java index cb10b3b77..8d26d3b8e 100644 --- a/httpclient/src/main/java/org/apache/http/auth/InvalidCredentialsException.java +++ b/httpclient/src/main/java/org/apache/http/auth/InvalidCredentialsException.java @@ -30,6 +30,8 @@ package org.apache.http.auth; +import net.jcip.annotations.Immutable; + /** * Authentication credentials required to respond to a authentication * challenge are invalid @@ -37,6 +39,7 @@ package org.apache.http.auth; * * @since 4.0 */ +@Immutable public class InvalidCredentialsException extends AuthenticationException { private static final long serialVersionUID = -4834003835215460648L; diff --git a/httpclient/src/main/java/org/apache/http/auth/MalformedChallengeException.java b/httpclient/src/main/java/org/apache/http/auth/MalformedChallengeException.java index 48bb2a5f4..fb3b6a705 100644 --- a/httpclient/src/main/java/org/apache/http/auth/MalformedChallengeException.java +++ b/httpclient/src/main/java/org/apache/http/auth/MalformedChallengeException.java @@ -30,6 +30,8 @@ package org.apache.http.auth; +import net.jcip.annotations.Immutable; + import org.apache.http.ProtocolException; /** @@ -39,6 +41,7 @@ import org.apache.http.ProtocolException; * * @since 4.0 */ +@Immutable public class MalformedChallengeException extends ProtocolException { private static final long serialVersionUID = 814586927989932284L; diff --git a/httpclient/src/main/java/org/apache/http/auth/NTCredentials.java b/httpclient/src/main/java/org/apache/http/auth/NTCredentials.java index 9bd19a39b..88fdd2f3f 100644 --- a/httpclient/src/main/java/org/apache/http/auth/NTCredentials.java +++ b/httpclient/src/main/java/org/apache/http/auth/NTCredentials.java @@ -33,6 +33,8 @@ package org.apache.http.auth; import java.security.Principal; import java.util.Locale; +import net.jcip.annotations.Immutable; + import org.apache.http.util.LangUtils; /** {@link Credentials} specific to the Windows platform. @@ -40,6 +42,7 @@ import org.apache.http.util.LangUtils; * * @since 2.0 */ +@Immutable public class NTCredentials implements Credentials { /** The user principal */ diff --git a/httpclient/src/main/java/org/apache/http/auth/NTUserPrincipal.java b/httpclient/src/main/java/org/apache/http/auth/NTUserPrincipal.java index 512c6c76a..872ca6318 100644 --- a/httpclient/src/main/java/org/apache/http/auth/NTUserPrincipal.java +++ b/httpclient/src/main/java/org/apache/http/auth/NTUserPrincipal.java @@ -33,6 +33,8 @@ package org.apache.http.auth; import java.security.Principal; import java.util.Locale; +import net.jcip.annotations.Immutable; + import org.apache.http.util.LangUtils; /** NT (MS Windows specific) user principal used for HTTP authentication @@ -40,6 +42,7 @@ import org.apache.http.util.LangUtils; * * @since 4.0 */ +@Immutable public class NTUserPrincipal implements Principal { private final String username; diff --git a/httpclient/src/main/java/org/apache/http/auth/UsernamePasswordCredentials.java b/httpclient/src/main/java/org/apache/http/auth/UsernamePasswordCredentials.java index e28bb9781..3987bbd22 100644 --- a/httpclient/src/main/java/org/apache/http/auth/UsernamePasswordCredentials.java +++ b/httpclient/src/main/java/org/apache/http/auth/UsernamePasswordCredentials.java @@ -32,6 +32,8 @@ package org.apache.http.auth; import java.security.Principal; +import net.jcip.annotations.Immutable; + import org.apache.http.util.LangUtils; /** @@ -43,11 +45,12 @@ import org.apache.http.util.LangUtils; * * @since 4.0 */ +@Immutable public class UsernamePasswordCredentials implements Credentials { private final BasicUserPrincipal principal; private final String password; - + /** * The constructor with the username and password combined string argument. *