diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/ContentSummary.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/ContentSummary.java
index 80a6c0c05b..79850e1a2f 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/ContentSummary.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/ContentSummary.java
@@ -466,7 +466,9 @@ private String formatSize(long size, boolean humanReadable) {
* @return Constant-width String representation of Erasure Coding Policy
*/
public String toErasureCodingPolicy() {
- return String.format(ERASURECODING_POLICY_FORMAT, erasureCodingPolicy);
+ return String.format(ERASURECODING_POLICY_FORMAT,
+ erasureCodingPolicy.equals("Replicated")
+ ? erasureCodingPolicy : "EC:" + erasureCodingPolicy);
}
/**
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testErasureCodingConf.xml b/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testErasureCodingConf.xml
index f527d35ef8..9c8f7e2698 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testErasureCodingConf.xml
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testErasureCodingConf.xml
@@ -983,7 +983,7 @@
RegexpComparator
- ( |\t)*1( |\t)*2( |\t)*0 EC:[A-Za-z0-9-]{1,}( )*/dir1
+ ( |\t)*1( |\t)*2( |\t)*0( )*EC:[A-Za-z0-9-]{1,}( )*/dir1
@@ -1004,7 +1004,7 @@
RegexpComparator
- ( |\t)*0( |\t)*1( |\t)*0 [A-Za-z0-9-]{1,}( )*/file1
+ ( |\t)*0( |\t)*1( |\t)*0( )*[A-Za-z0-9-]{1,}( )*/file1