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 1c1e769809c..7c0a4a33666 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?"": ""; + /** Four apostrophes. */ + public static final String ESCAPED = "''''"; + @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();