From 55b61efab620468130be3c43542041869bc229da Mon Sep 17 00:00:00 2001 From: Alejandro Abdelnur Date: Mon, 18 Jun 2012 16:31:26 +0000 Subject: [PATCH] Merge -r 1351407:1351408 from trunk to branch. FIXES: HADOOP-8512 git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1351409 13f79535-47bb-0310-9956-ffa450edef68 --- .../security/authentication/client/AuthenticatedURL.java | 1 + .../authentication/client/TestAuthenticatedURL.java | 6 +++++- hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/client/AuthenticatedURL.java b/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/client/AuthenticatedURL.java index 5a446609c2b..3c59d40b3ae 100644 --- a/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/client/AuthenticatedURL.java +++ b/hadoop-common-project/hadoop-auth/src/main/java/org/apache/hadoop/security/authentication/client/AuthenticatedURL.java @@ -266,6 +266,7 @@ public class AuthenticatedURL { } } } else { + token.set(null); throw new AuthenticationException("Authentication failed, status: " + conn.getResponseCode() + ", message: " + conn.getResponseMessage()); } diff --git a/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/TestAuthenticatedURL.java b/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/TestAuthenticatedURL.java index 525af62606e..213818793f5 100644 --- a/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/TestAuthenticatedURL.java +++ b/hadoop-common-project/hadoop-auth/src/test/java/org/apache/hadoop/security/authentication/client/TestAuthenticatedURL.java @@ -13,6 +13,7 @@ */ package org.apache.hadoop.security.authentication.client; +import junit.framework.Assert; import junit.framework.TestCase; import org.mockito.Mockito; @@ -100,11 +101,14 @@ public class TestAuthenticatedURL extends TestCase { headers.put("Set-Cookie", cookies); Mockito.when(conn.getHeaderFields()).thenReturn(headers); + AuthenticatedURL.Token token = new AuthenticatedURL.Token(); + token.set("bar"); try { - AuthenticatedURL.extractToken(conn, new AuthenticatedURL.Token()); + AuthenticatedURL.extractToken(conn, token); fail(); } catch (AuthenticationException ex) { // Expected + Assert.assertFalse(token.isSet()); } catch (Exception ex) { fail(); } diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index ebcdd428998..3c9b5585f86 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -96,6 +96,9 @@ Release 2.0.1-alpha - UNRELEASED HADOOP-8509. JarFinder duplicate entry: META-INF/MANIFEST.MF exception (tucu) + HADOOP-8512. AuthenticatedURL should reset the Token when the server returns + other than OK on authentication (tucu) + BREAKDOWN OF HDFS-3042 SUBTASKS HADOOP-8220. ZKFailoverController doesn't handle failure to become active