diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirErasureCodingOp.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirErasureCodingOp.java index 6628b56a132e0..4034c7009c87b 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirErasureCodingOp.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirErasureCodingOp.java @@ -168,8 +168,8 @@ private static List setErasureCodingPolicyXAttr(final FSNamesystem fsn, throw new FileNotFoundException("Path not found: " + srcIIP.getPath()); } if (!inode.isDirectory()) { - throw new IOException("Attempt to set an erasure coding policy " + - "for a file " + src); + throw new IOException("Cannot set an erasure coding policy " + + "for a file " + src + ". Expected to be a directory"); } final XAttr ecXAttr; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestUnsetAndChangeDirectoryEcPolicy.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestUnsetAndChangeDirectoryEcPolicy.java index 4f33ce759626f..959a1d9b69575 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestUnsetAndChangeDirectoryEcPolicy.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestUnsetAndChangeDirectoryEcPolicy.java @@ -362,8 +362,8 @@ public void testEcPolicyOnFile() throws Exception { fs.setErasureCodingPolicy(ecFilePath, ecPolicy.getName()); fail("IOException should be thrown for setting EC policy on file"); } catch (IOException e) { - assertExceptionContains("Attempt to set an erasure coding policy " + - "for a file " + ecFilePath, e); + assertExceptionContains("Cannot set an erasure coding policy " + + "for a file " + ecFilePath + ". Expected to be a directory", e); } // Unset EC policy on file