From 144ab4b15bc3bfa5f111308f1d29c6c0d1c0ca73 Mon Sep 17 00:00:00 2001 From: Tsz-wo Sze Date: Fri, 28 Mar 2014 18:16:28 +0000 Subject: [PATCH] svn merge -c 1582851 from trunk for HADOOP-10449. Fix the javac warnings in the security package. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1582852 13f79535-47bb-0310-9956-ffa450edef68 --- .../hadoop-common/CHANGES.txt | 2 ++ .../hadoop/security/LdapGroupsMapping.java | 1 - .../apache/hadoop/security/NetgroupCache.java | 3 --- .../apache/hadoop/security/SaslRpcServer.java | 2 -- .../security/ssl/SSLHostnameVerifier.java | 26 +++++++++---------- 5 files changed, 14 insertions(+), 20 deletions(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 7acb08ca6af..01729330fb6 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -162,6 +162,8 @@ Release 2.4.0 - UNRELEASED HADOOP-10441. Namenode metric "rpc.RetryCache/NameNodeRetryCache.CacheHit" can't be correctly processed by Ganglia. (jing9) + HADOOP-10449. Fix the javac warnings in the security package. (szetszwo) + BREAKDOWN OF HADOOP-10184 SUBTASKS AND RELATED JIRAS HADOOP-10185. FileSystem API for ACLs. (cnauroth) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/LdapGroupsMapping.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/LdapGroupsMapping.java index c542b2aea06..754c3871358 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/LdapGroupsMapping.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/LdapGroupsMapping.java @@ -251,7 +251,6 @@ List doGetGroups(String user) throws NamingException { return groups; } - @SuppressWarnings("deprecation") DirContext getDirContext() throws NamingException { if (ctx == null) { // Set up the initial environment for LDAP connectivity diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/NetgroupCache.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/NetgroupCache.java index 7be5316db97..d07ae2bd018 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/NetgroupCache.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/NetgroupCache.java @@ -39,9 +39,6 @@ @InterfaceAudience.LimitedPrivate({"HDFS", "MapReduce"}) @InterfaceStability.Unstable public class NetgroupCache { - - private static final Log LOG = LogFactory.getLog(NetgroupCache.class); - private static boolean netgroupToUsersMapUpdated = true; private static Map> netgroupToUsersMap = new ConcurrentHashMap>(); diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslRpcServer.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslRpcServer.java index 6efb9766084..8240fdeedef 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslRpcServer.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/SaslRpcServer.java @@ -57,7 +57,6 @@ import org.apache.hadoop.security.token.SecretManager; import org.apache.hadoop.security.token.SecretManager.InvalidToken; import org.apache.hadoop.security.token.TokenIdentifier; -import org.apache.hadoop.util.StringUtils; /** * A utility class for dealing with SASL on RPC server @@ -70,7 +69,6 @@ public class SaslRpcServer { public static final Map SASL_PROPS = new TreeMap(); private static SaslServerFactory saslFactory; - private static SaslPropertiesResolver resolver; public static enum QualityOfProtection { AUTHENTICATION("auth"), diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/SSLHostnameVerifier.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/SSLHostnameVerifier.java index c59000ea6a4..dd5e67b48bc 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/SSLHostnameVerifier.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/SSLHostnameVerifier.java @@ -31,9 +31,6 @@ package org.apache.hadoop.security.ssl; -import org.apache.hadoop.classification.InterfaceAudience; -import org.apache.hadoop.classification.InterfaceStability; - import java.io.IOException; import java.io.InputStream; import java.security.cert.Certificate; @@ -44,6 +41,7 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.List; +import java.util.Set; import java.util.StringTokenizer; import java.util.TreeSet; @@ -52,6 +50,9 @@ import javax.net.ssl.SSLSession; import javax.net.ssl.SSLSocket; +import org.apache.hadoop.classification.InterfaceAudience; +import org.apache.hadoop.classification.InterfaceStability; + /** ************************************************************************ * Copied from the not-yet-commons-ssl project at @@ -224,7 +225,6 @@ public final void check(final String[] host, final String[] cns, public final String toString() { return "ALLOW_ALL"; } }; - @SuppressWarnings("unchecked") abstract class AbstractVerifier implements SSLHostnameVerifier { /** @@ -378,7 +378,7 @@ public void check(final String[] hosts, final String[] cns, // STRICT implementations of the HostnameVerifier only use the // first CN provided. All other CNs are ignored. // (Firefox, wget, curl, Sun Java 1.4, 5, 6 all work this way). - TreeSet names = new TreeSet(); + final Set names = new TreeSet(); if (cns != null && cns.length > 0 && cns[0] != null) { names.add(cns[0]); if (ie6) { @@ -404,10 +404,9 @@ public void check(final String[] hosts, final String[] cns, boolean match = false; out: - for (Iterator it = names.iterator(); it.hasNext();) { + for (Iterator it = names.iterator(); it.hasNext();) { // Don't trim the CN, though! - String cn = (String) it.next(); - cn = cn.toLowerCase(); + final String cn = it.next().toLowerCase(); // Store CN in StringBuffer in case we need to report an error. buf.append(" <"); buf.append(cn); @@ -508,10 +507,9 @@ public static int countDots(final String s) { } } - @SuppressWarnings("unchecked") static class Certificates { public static String[] getCNs(X509Certificate cert) { - LinkedList cnList = new LinkedList(); + final List cnList = new LinkedList(); /* Sebastian Hauer's original StrictSSLProtocolSocketFactory used getName() and had the following comment: @@ -568,8 +566,8 @@ Looks like toString() even works with non-ascii domain names! * @return Array of SubjectALT DNS names stored in the certificate. */ public static String[] getDNSSubjectAlts(X509Certificate cert) { - LinkedList subjectAltList = new LinkedList(); - Collection c = null; + final List subjectAltList = new LinkedList(); + Collection> c = null; try { c = cert.getSubjectAlternativeNames(); } @@ -578,9 +576,9 @@ public static String[] getDNSSubjectAlts(X509Certificate cert) { cpe.printStackTrace(); } if (c != null) { - Iterator it = c.iterator(); + Iterator> it = c.iterator(); while (it.hasNext()) { - List list = (List) it.next(); + List list = it.next(); int type = ((Integer) list.get(0)).intValue(); // If type is 2, then we've got a dNSName if (type == 2) {