diff --git a/core/java/src/org/apache/http/conn/ssl/DefaultHostnameVerifier.java b/core/java/src/org/apache/http/conn/ssl/DefaultHostnameVerifier.java index 03a1edb9185d104be39be79d37456e09105c6614..39318b308eb803a13c22ec3b0f1526d2cc282e20 100644 --- a/core/java/src/org/apache/http/conn/ssl/DefaultHostnameVerifier.java +++ b/core/java/src/org/apache/http/conn/ssl/DefaultHostnameVerifier.java @@ -49,24 +49,23 @@ import javax.net.ssl.SSLException; import javax.net.ssl.SSLSession; import javax.security.auth.x500.X500Principal; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.http.annotation.Immutable; import org.apache.http.conn.util.InetAddressUtils; import org.apache.http.conn.util.PublicSuffixMatcher; +import net.i2p.I2PAppContext; +import net.i2p.util.Log; + /** * Default {@link javax.net.ssl.HostnameVerifier} implementation. * * @since 4.4 */ -@Immutable public final class DefaultHostnameVerifier implements HostnameVerifier { final static int DNS_NAME_TYPE = 2; final static int IP_ADDRESS_TYPE = 7; - private final Log log = LogFactory.getLog(getClass()); + private final Log log = I2PAppContext.getGlobalContext().logManager().getLog(getClass()); private final PublicSuffixMatcher publicSuffixMatcher; @@ -86,8 +85,8 @@ public final class DefaultHostnameVerifier implements HostnameVerifier { verify(host, x509); return true; } catch(final SSLException ex) { - if (log.isDebugEnabled()) { - log.debug(ex.getMessage(), ex); + if (log.shouldWarn()) { + log.warn(ex.getMessage(), ex); } return false; } diff --git a/core/java/src/org/apache/http/conn/util/InetAddressUtils.java b/core/java/src/org/apache/http/conn/util/InetAddressUtils.java index acee8afa2372dc810f22523ac617beafbcb27281..c7b8b85e756ce5a5c415f60dd6f94f4c35b2f870 100644 --- a/core/java/src/org/apache/http/conn/util/InetAddressUtils.java +++ b/core/java/src/org/apache/http/conn/util/InetAddressUtils.java @@ -29,14 +29,12 @@ package org.apache.http.conn.util; import java.util.regex.Pattern; -import org.apache.http.annotation.Immutable; /** * A collection of utilities relating to InetAddresses. * * @since 4.0 */ -@Immutable public class InetAddressUtils { private InetAddressUtils() { diff --git a/core/java/src/org/apache/http/conn/util/PublicSuffixList.java b/core/java/src/org/apache/http/conn/util/PublicSuffixList.java index ec15c9d40b22a5797355aedacca2844e8b310bb1..cf6b959c939643f1cf6c829f0817524ddc46f8d4 100644 --- a/core/java/src/org/apache/http/conn/util/PublicSuffixList.java +++ b/core/java/src/org/apache/http/conn/util/PublicSuffixList.java @@ -29,7 +29,6 @@ package org.apache.http.conn.util; import java.util.Collections; import java.util.List; -import org.apache.http.annotation.Immutable; import org.apache.http.util.Args; /** @@ -41,7 +40,6 @@ import org.apache.http.util.Args; * * @since 4.4 */ -@Immutable public final class PublicSuffixList { private final List<String> rules; diff --git a/core/java/src/org/apache/http/conn/util/PublicSuffixListParser.java b/core/java/src/org/apache/http/conn/util/PublicSuffixListParser.java index 84bbd182fc8fe5b28615e44610732184efbd4ea1..2cd2f4ec49cf38c2a6c34f0506d796e7aa0f6985 100644 --- a/core/java/src/org/apache/http/conn/util/PublicSuffixListParser.java +++ b/core/java/src/org/apache/http/conn/util/PublicSuffixListParser.java @@ -32,7 +32,6 @@ import java.io.Reader; import java.util.ArrayList; import java.util.List; -import org.apache.http.annotation.Immutable; /** * Parses the list from <a href="http://publicsuffix.org/">publicsuffix.org</a> @@ -40,7 +39,6 @@ import org.apache.http.annotation.Immutable; * * @since 4.4 */ -@Immutable public final class PublicSuffixListParser { private static final int MAX_LINE_LEN = 256; diff --git a/core/java/src/org/apache/http/conn/util/PublicSuffixMatcher.java b/core/java/src/org/apache/http/conn/util/PublicSuffixMatcher.java index 02393aca4d517bbd09986cd0b291ddcdef222909..6da27bb7aa3949470c1a6c7125fc56f6f64a743a 100644 --- a/core/java/src/org/apache/http/conn/util/PublicSuffixMatcher.java +++ b/core/java/src/org/apache/http/conn/util/PublicSuffixMatcher.java @@ -32,7 +32,6 @@ import java.util.Locale; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import org.apache.http.annotation.ThreadSafe; import org.apache.http.util.Args; /** @@ -45,7 +44,6 @@ import org.apache.http.util.Args; * * @since 4.4 */ -@ThreadSafe public final class PublicSuffixMatcher { private final Map<String, String> rules; diff --git a/core/java/src/org/apache/http/util/Args.java b/core/java/src/org/apache/http/util/Args.java index 9eb8a251ff3c64b1a85568184cab002fc45fb4b2..b39d87a7ecac8765264edd4f04840bec441111c6 100644 --- a/core/java/src/org/apache/http/util/Args.java +++ b/core/java/src/org/apache/http/util/Args.java @@ -27,101 +27,12 @@ package org.apache.http.util; -import java.util.Collection; - public class Args { - public static void check(final boolean expression, final String message) { - if (!expression) { - throw new IllegalArgumentException(message); - } - } - - public static void check(final boolean expression, final String message, final Object... args) { - if (!expression) { - throw new IllegalArgumentException(String.format(message, args)); - } - } - - public static void check(final boolean expression, final String message, final Object arg) { - if (!expression) { - throw new IllegalArgumentException(String.format(message, arg)); - } - } - public static <T> T notNull(final T argument, final String name) { if (argument == null) { throw new IllegalArgumentException(name + " may not be null"); } return argument; } - - public static <T extends CharSequence> T notEmpty(final T argument, final String name) { - if (argument == null) { - throw new IllegalArgumentException(name + " may not be null"); - } - if (TextUtils.isEmpty(argument)) { - throw new IllegalArgumentException(name + " may not be empty"); - } - return argument; - } - - public static <T extends CharSequence> T notBlank(final T argument, final String name) { - if (argument == null) { - throw new IllegalArgumentException(name + " may not be null"); - } - if (TextUtils.isBlank(argument)) { - throw new IllegalArgumentException(name + " may not be blank"); - } - return argument; - } - - public static <T extends CharSequence> T containsNoBlanks(final T argument, final String name) { - if (argument == null) { - throw new IllegalArgumentException(name + " may not be null"); - } - if (TextUtils.containsBlanks(argument)) { - throw new IllegalArgumentException(name + " may not contain blanks"); - } - return argument; - } - - public static <E, T extends Collection<E>> T notEmpty(final T argument, final String name) { - if (argument == null) { - throw new IllegalArgumentException(name + " may not be null"); - } - if (argument.isEmpty()) { - throw new IllegalArgumentException(name + " may not be empty"); - } - return argument; - } - - public static int positive(final int n, final String name) { - if (n <= 0) { - throw new IllegalArgumentException(name + " may not be negative or zero"); - } - return n; - } - - public static long positive(final long n, final String name) { - if (n <= 0) { - throw new IllegalArgumentException(name + " may not be negative or zero"); - } - return n; - } - - public static int notNegative(final int n, final String name) { - if (n < 0) { - throw new IllegalArgumentException(name + " may not be negative"); - } - return n; - } - - public static long notNegative(final long n, final String name) { - if (n < 0) { - throw new IllegalArgumentException(name + " may not be negative"); - } - return n; - } - }