From f6319b513129448a4304294e54e50b344dce52e0 Mon Sep 17 00:00:00 2001 From: Andrew Wang Date: Fri, 29 Aug 2014 15:47:01 -0700 Subject: [PATCH] HDFS-6972. TestRefreshUserMappings.testRefreshSuperUserGroupsConfiguration doesn't decode url correctly. Contributed by Yongjun Zhang. (cherry picked from commit 6066b1a4551bb70bba2789ac05bf9ddbe72c10e8) Conflicts: hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../hadoop/security/TestRefreshUserMappings.java | 12 ++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 5414aea9fe8..6e385db9bbd 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -313,6 +313,9 @@ Release 2.6.0 - UNRELEASED HDFS-6902. FileWriter should be closed in finally block in BlockReceiver#receiveBlock() (Tsuyoshi OZAWA via Colin Patrick McCabe) + HDFS-6972. TestRefreshUserMappings.testRefreshSuperUserGroupsConfiguration + doesn't decode url correctly. (Yongjun Zhang via wang) + BREAKDOWN OF HDFS-6134 AND HADOOP-10150 SUBTASKS AND RELATED JIRAS HDFS-6387. HDFS CLI admin tool for creating & deleting an diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/security/TestRefreshUserMappings.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/security/TestRefreshUserMappings.java index 72776e03ceb..ca67245371b 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/security/TestRefreshUserMappings.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/security/TestRefreshUserMappings.java @@ -30,7 +30,9 @@ import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.PrintWriter; +import java.io.UnsupportedEncodingException; import java.net.URL; +import java.net.URLDecoder; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -225,15 +227,17 @@ public class TestRefreshUserMappings { } private void addNewConfigResource(String rsrcName, String keyGroup, - String groups, String keyHosts, String hosts) throws FileNotFoundException { + String groups, String keyHosts, String hosts) + throws FileNotFoundException, UnsupportedEncodingException { // location for temp resource should be in CLASSPATH Configuration conf = new Configuration(); URL url = conf.getResource("hdfs-site.xml"); - Path p = new Path(url.getPath()); + + String urlPath = URLDecoder.decode(url.getPath().toString(), "UTF-8"); + Path p = new Path(urlPath); Path dir = p.getParent(); tempResource = dir.toString() + "/" + rsrcName; - - + String newResource = ""+ "" + keyGroup + ""+groups+"" +