hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lium...@apache.org
Subject hadoop git commit: HADOOP-13810. Add a test to verify that Configuration handles &-encoded characters. Contributed by Steve Loughran
Date Tue, 15 Nov 2016 03:55:28 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 818915aab -> 0b428075a


HADOOP-13810. Add a test to verify that Configuration handles &-encoded characters. Contributed
by Steve Loughran

This closes #158

(cherry picked from commit 04014c4c739bb4e3bc3fdf9299abc0f47521e8fd)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/0b428075
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/0b428075
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/0b428075

Branch: refs/heads/branch-2
Commit: 0b428075a29e8bdcafacc13917b3e3d49f3fdaa1
Parents: 818915a
Author: Mingliang Liu <liuml07@apache.org>
Authored: Mon Nov 14 19:37:50 2016 -0800
Committer: Mingliang Liu <liuml07@apache.org>
Committed: Mon Nov 14 19:41:32 2016 -0800

----------------------------------------------------------------------
 .../org/apache/hadoop/conf/TestConfiguration.java   | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/0b428075/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/conf/TestConfiguration.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/conf/TestConfiguration.java
b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/conf/TestConfiguration.java
index 1c1e769..7c0a4a3 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/conf/TestConfiguration.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/conf/TestConfiguration.java
@@ -70,6 +70,9 @@ public class TestConfiguration extends TestCase {
             IBM_JAVA?"<?xml version=\"1.0\" encoding=\"UTF-8\"?><configuration>":
   "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><configuration>";
 
+  /** Four apostrophes. */
+  public static final String ESCAPED = "&apos;&#39;&#0039;&#x27;";
+
   @Override
   protected void setUp() throws Exception {
     super.setUp();
@@ -314,7 +317,18 @@ public class TestConfiguration extends TestCase {
     //two spaces one after "this", one before "contains"
     assertEquals("this  contains a comment", conf.get("my.comment"));
   }
-  
+
+  public void testEscapedCharactersInValue() throws IOException {
+    out=new BufferedWriter(new FileWriter(CONFIG));
+    startConfig();
+    appendProperty("my.comment", ESCAPED);
+    endConfig();
+    Path fileResource = new Path(CONFIG);
+    conf.addResource(fileResource);
+    //two spaces one after "this", one before "contains"
+    assertEquals("''''", conf.get("my.comment"));
+  }
+
   public void testTrim() throws IOException {
     out=new BufferedWriter(new FileWriter(CONFIG));
     startConfig();


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message