You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by sz...@apache.org on 2014/03/08 03:20:10 UTC

svn commit: r1575472 - in /hadoop/common/branches/branch-2.4/hadoop-common-project: ./ hadoop-auth/ hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/client/ hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/ ...

Author: szetszwo
Date: Sat Mar  8 02:20:09 2014
New Revision: 1575472

URL: http://svn.apache.org/r1575472
Log:
svn merge -c 1575470 from trunk for HADOOP-10393. Fix the javac warnings in hadoop-auth.  (szetszwo)

Modified:
    hadoop/common/branches/branch-2.4/hadoop-common-project/   (props changed)
    hadoop/common/branches/branch-2.4/hadoop-common-project/hadoop-auth/   (props changed)
    hadoop/common/branches/branch-2.4/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/client/KerberosAuthenticator.java
    hadoop/common/branches/branch-2.4/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/TestKerberosAuthenticator.java
    hadoop/common/branches/branch-2.4/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/TestPseudoAuthenticator.java
    hadoop/common/branches/branch-2.4/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/server/TestAuthenticationFilter.java
    hadoop/common/branches/branch-2.4/hadoop-common-project/hadoop-common/   (props changed)
    hadoop/common/branches/branch-2.4/hadoop-common-project/hadoop-common/CHANGES.txt   (contents, props changed)
    hadoop/common/branches/branch-2.4/hadoop-common-project/hadoop-minikdc/src/main/java/org/apache/hadoop/minikdc/MiniKdc.java

Propchange: hadoop/common/branches/branch-2.4/hadoop-common-project/
------------------------------------------------------------------------------
  Merged /hadoop/common/trunk/hadoop-common-project:r1575470

Propchange: hadoop/common/branches/branch-2.4/hadoop-common-project/hadoop-auth/
------------------------------------------------------------------------------
  Merged /hadoop/common/trunk/hadoop-common-project/hadoop-auth:r1575470

Modified: hadoop/common/branches/branch-2.4/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/client/KerberosAuthenticator.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.4/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/client/KerberosAuthenticator.java?rev=1575472&r1=1575471&r2=1575472&view=diff
==============================================================================
--- hadoop/common/branches/branch-2.4/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/client/KerberosAuthenticator.java (original)
+++ hadoop/common/branches/branch-2.4/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/client/KerberosAuthenticator.java Sat Mar  8 02:20:09 2014
@@ -313,7 +313,7 @@ public class KerberosAuthenticator imple
   /*
   * Sends the Kerberos token to the server.
   */
-  private void sendToken(byte[] outToken) throws IOException, AuthenticationException {
+  private void sendToken(byte[] outToken) throws IOException {
     String token = base64.encodeToString(outToken);
     conn = (HttpURLConnection) url.openConnection();
     if (connConfigurator != null) {

Modified: hadoop/common/branches/branch-2.4/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/TestKerberosAuthenticator.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.4/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/TestKerberosAuthenticator.java?rev=1575472&r1=1575471&r2=1575472&view=diff
==============================================================================
--- hadoop/common/branches/branch-2.4/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/TestKerberosAuthenticator.java (original)
+++ hadoop/common/branches/branch-2.4/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/TestKerberosAuthenticator.java Sat Mar  8 02:20:09 2014
@@ -57,7 +57,7 @@ public class TestKerberosAuthenticator e
     Properties props = new Properties();
     props.setProperty(AuthenticationFilter.AUTH_TYPE, "simple");
     props.setProperty(PseudoAuthenticationHandler.ANONYMOUS_ALLOWED, "false");
-    auth.setAuthenticationHandlerConfig(props);
+    AuthenticatorTestCase.setAuthenticationHandlerConfig(props);
     auth._testAuthentication(new KerberosAuthenticator(), false);
   }
 
@@ -67,14 +67,14 @@ public class TestKerberosAuthenticator e
     Properties props = new Properties();
     props.setProperty(AuthenticationFilter.AUTH_TYPE, "simple");
     props.setProperty(PseudoAuthenticationHandler.ANONYMOUS_ALLOWED, "true");
-    auth.setAuthenticationHandlerConfig(props);
+    AuthenticatorTestCase.setAuthenticationHandlerConfig(props);
     auth._testAuthentication(new KerberosAuthenticator(), false);
   }
 
   @Test(timeout=60000)
   public void testNotAuthenticated() throws Exception {
     AuthenticatorTestCase auth = new AuthenticatorTestCase();
-    auth.setAuthenticationHandlerConfig(getAuthenticationHandlerConfiguration());
+    AuthenticatorTestCase.setAuthenticationHandlerConfig(getAuthenticationHandlerConfiguration());
     auth.start();
     try {
       URL url = new URL(auth.getBaseURL());
@@ -90,7 +90,7 @@ public class TestKerberosAuthenticator e
   @Test(timeout=60000)
   public void testAuthentication() throws Exception {
     final AuthenticatorTestCase auth = new AuthenticatorTestCase();
-    auth.setAuthenticationHandlerConfig(
+    AuthenticatorTestCase.setAuthenticationHandlerConfig(
             getAuthenticationHandlerConfiguration());
     KerberosTestUtils.doAsClient(new Callable<Void>() {
       @Override
@@ -104,7 +104,7 @@ public class TestKerberosAuthenticator e
   @Test(timeout=60000)
   public void testAuthenticationPost() throws Exception {
     final AuthenticatorTestCase auth = new AuthenticatorTestCase();
-    auth.setAuthenticationHandlerConfig(
+    AuthenticatorTestCase.setAuthenticationHandlerConfig(
             getAuthenticationHandlerConfiguration());
     KerberosTestUtils.doAsClient(new Callable<Void>() {
       @Override

Modified: hadoop/common/branches/branch-2.4/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/TestPseudoAuthenticator.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.4/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/TestPseudoAuthenticator.java?rev=1575472&r1=1575471&r2=1575472&view=diff
==============================================================================
--- hadoop/common/branches/branch-2.4/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/TestPseudoAuthenticator.java (original)
+++ hadoop/common/branches/branch-2.4/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/TestPseudoAuthenticator.java Sat Mar  8 02:20:09 2014
@@ -40,7 +40,7 @@ public class TestPseudoAuthenticator {
   @Test
   public void testAnonymousAllowed() throws Exception {
     AuthenticatorTestCase auth = new AuthenticatorTestCase();
-    auth.setAuthenticationHandlerConfig(
+    AuthenticatorTestCase.setAuthenticationHandlerConfig(
             getAuthenticationHandlerConfiguration(true));
     auth.start();
     try {
@@ -56,7 +56,7 @@ public class TestPseudoAuthenticator {
   @Test
   public void testAnonymousDisallowed() throws Exception {
     AuthenticatorTestCase auth = new AuthenticatorTestCase();
-    auth.setAuthenticationHandlerConfig(
+    AuthenticatorTestCase.setAuthenticationHandlerConfig(
             getAuthenticationHandlerConfiguration(false));
     auth.start();
     try {
@@ -72,7 +72,7 @@ public class TestPseudoAuthenticator {
   @Test
   public void testAuthenticationAnonymousAllowed() throws Exception {
     AuthenticatorTestCase auth = new AuthenticatorTestCase();
-    auth.setAuthenticationHandlerConfig(
+    AuthenticatorTestCase.setAuthenticationHandlerConfig(
             getAuthenticationHandlerConfiguration(true));
     auth._testAuthentication(new PseudoAuthenticator(), false);
   }
@@ -80,7 +80,7 @@ public class TestPseudoAuthenticator {
   @Test
   public void testAuthenticationAnonymousDisallowed() throws Exception {
     AuthenticatorTestCase auth = new AuthenticatorTestCase();
-    auth.setAuthenticationHandlerConfig(
+    AuthenticatorTestCase.setAuthenticationHandlerConfig(
             getAuthenticationHandlerConfiguration(false));
     auth._testAuthentication(new PseudoAuthenticator(), false);
   }
@@ -88,7 +88,7 @@ public class TestPseudoAuthenticator {
   @Test
   public void testAuthenticationAnonymousAllowedWithPost() throws Exception {
     AuthenticatorTestCase auth = new AuthenticatorTestCase();
-    auth.setAuthenticationHandlerConfig(
+    AuthenticatorTestCase.setAuthenticationHandlerConfig(
             getAuthenticationHandlerConfiguration(true));
     auth._testAuthentication(new PseudoAuthenticator(), true);
   }
@@ -96,7 +96,7 @@ public class TestPseudoAuthenticator {
   @Test
   public void testAuthenticationAnonymousDisallowedWithPost() throws Exception {
     AuthenticatorTestCase auth = new AuthenticatorTestCase();
-    auth.setAuthenticationHandlerConfig(
+    AuthenticatorTestCase.setAuthenticationHandlerConfig(
             getAuthenticationHandlerConfiguration(false));
     auth._testAuthentication(new PseudoAuthenticator(), true);
   }

Modified: hadoop/common/branches/branch-2.4/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/server/TestAuthenticationFilter.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.4/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/server/TestAuthenticationFilter.java?rev=1575472&r1=1575471&r2=1575472&view=diff
==============================================================================
--- hadoop/common/branches/branch-2.4/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/server/TestAuthenticationFilter.java (original)
+++ hadoop/common/branches/branch-2.4/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/server/TestAuthenticationFilter.java Sat Mar  8 02:20:09 2014
@@ -13,15 +13,11 @@
  */
 package org.apache.hadoop.security.authentication.server;
 
-import org.apache.hadoop.security.authentication.client.AuthenticatedURL;
-import org.apache.hadoop.security.authentication.client.AuthenticationException;
-import org.apache.hadoop.security.authentication.util.Signer;
-import org.junit.Assert;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Properties;
+import java.util.Vector;
 
 import javax.servlet.FilterChain;
 import javax.servlet.FilterConfig;
@@ -31,8 +27,15 @@ import javax.servlet.ServletResponse;
 import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.*;
+
+import org.apache.hadoop.security.authentication.client.AuthenticatedURL;
+import org.apache.hadoop.security.authentication.client.AuthenticationException;
+import org.apache.hadoop.security.authentication.util.Signer;
+import org.junit.Assert;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
 
 public class TestAuthenticationFilter {
 

Propchange: hadoop/common/branches/branch-2.4/hadoop-common-project/hadoop-common/
------------------------------------------------------------------------------
  Merged /hadoop/common/trunk/hadoop-common-project/hadoop-common:r1575470

Modified: hadoop/common/branches/branch-2.4/hadoop-common-project/hadoop-common/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.4/hadoop-common-project/hadoop-common/CHANGES.txt?rev=1575472&r1=1575471&r2=1575472&view=diff
==============================================================================
--- hadoop/common/branches/branch-2.4/hadoop-common-project/hadoop-common/CHANGES.txt (original)
+++ hadoop/common/branches/branch-2.4/hadoop-common-project/hadoop-common/CHANGES.txt Sat Mar  8 02:20:09 2014
@@ -90,6 +90,8 @@ Release 2.4.0 - UNRELEASED
     HADOOP-10353. FsUrlStreamHandlerFactory is not thread safe.
     (Tudor Scurtu via cnauroth)
 
+    HADOOP-10393. Fix the javac warnings in hadoop-auth.  (szetszwo)
+
   BREAKDOWN OF HADOOP-10184 SUBTASKS AND RELATED JIRAS
 
     HADOOP-10185. FileSystem API for ACLs. (cnauroth)

Propchange: hadoop/common/branches/branch-2.4/hadoop-common-project/hadoop-common/CHANGES.txt
------------------------------------------------------------------------------
  Merged /hadoop/common/trunk/hadoop-common-project/hadoop-common/CHANGES.txt:r1575470

Modified: hadoop/common/branches/branch-2.4/hadoop-common-project/hadoop-minikdc/src/main/java/org/apache/hadoop/minikdc/MiniKdc.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.4/hadoop-common-project/hadoop-minikdc/src/main/java/org/apache/hadoop/minikdc/MiniKdc.java?rev=1575472&r1=1575471&r2=1575472&view=diff
==============================================================================
--- hadoop/common/branches/branch-2.4/hadoop-common-project/hadoop-minikdc/src/main/java/org/apache/hadoop/minikdc/MiniKdc.java (original)
+++ hadoop/common/branches/branch-2.4/hadoop-common-project/hadoop-minikdc/src/main/java/org/apache/hadoop/minikdc/MiniKdc.java Sat Mar  8 02:20:09 2014
@@ -41,6 +41,7 @@ import org.apache.directory.server.kerbe
 import org.apache.directory.server.kerberos.shared.keytab.KeytabEntry;
 import org.apache.directory.server.protocol.shared.transport.TcpTransport;
 import org.apache.directory.server.protocol.shared.transport.UdpTransport;
+import org.apache.directory.server.xdbm.Index;
 import org.apache.directory.shared.kerberos.KerberosTime;
 import org.apache.directory.shared.kerberos.codec.types.EncryptionType;
 import org.apache.directory.shared.kerberos.components.EncryptionKey;
@@ -134,7 +135,7 @@ public class MiniKdc {
         r.close();
       }
     }
-    for (Map.Entry entry : userConf.entrySet()) {
+    for (Map.Entry<?, ?> entry : userConf.entrySet()) {
       conf.put(entry.getKey(), entry.getValue());
     }
     final MiniKdc miniKdc = new MiniKdc(conf, workDir);
@@ -250,7 +251,7 @@ public class MiniKdc {
     }
     LOG.info("Configuration:");
     LOG.info("---------------------------------------------------------------");
-    for (Map.Entry entry : conf.entrySet()) {
+    for (Map.Entry<?, ?> entry : conf.entrySet()) {
       LOG.info("  {}: {}", entry.getKey(), entry.getValue());
     }
     LOG.info("---------------------------------------------------------------");
@@ -311,7 +312,6 @@ public class MiniKdc {
     initKDCServer();
   }
 
-  @SuppressWarnings("unchecked")
   private void initDirectoryService() throws Exception {
     ds = new DefaultDirectoryService();
     ds.setInstanceLayout(new InstanceLayout(workDir));
@@ -364,7 +364,7 @@ public class MiniKdc {
     partition.setSuffixDn(new Dn("dc=" + orgName + ",dc=" + orgDomain));
     ds.addPartition(partition);
     // indexes
-    Set indexedAttributes = new HashSet();
+    Set<Index<?, ?, String>> indexedAttributes = new HashSet<Index<?, ?, String>>();
     indexedAttributes.add(new JdbmIndex<String, Entry>("objectClass", false));
     indexedAttributes.add(new JdbmIndex<String, Entry>("dc", false));
     indexedAttributes.add(new JdbmIndex<String, Entry>("ou", false));
@@ -398,9 +398,13 @@ public class MiniKdc {
     SchemaManager schemaManager = ds.getSchemaManager();
     final String content = StrSubstitutor.replace(IOUtils.toString(is), map);
     LdifReader reader = new LdifReader(new StringReader(content));
-    for (LdifEntry ldifEntry : reader) {
-      ds.getAdminSession().add(new DefaultEntry(schemaManager,
-              ldifEntry.getEntry()));
+    try {
+      for (LdifEntry ldifEntry : reader) {
+        ds.getAdminSession().add(new DefaultEntry(schemaManager,
+                ldifEntry.getEntry()));
+      }
+    } finally {
+      reader.close();
     }
 
     kdc = new KdcServer();