瀏覽代碼

HDFS-1016. HDFS side change for HADOOP-6569. Contributed by Hairong Kuang.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hdfs/trunk@919680 13f79535-47bb-0310-9956-ffa450edef68
Hairong Kuang 15 年之前
父節點
當前提交
86d7b4b9ad

+ 4 - 0
CHANGES.txt

@@ -9,6 +9,10 @@ Trunk (unreleased changes)
 
     HDFS-984. Persistent delegation tokens. (Jitendra Pandey via shv)
 
+    HDFS-1016. HDFS side change for HADOOP-6569. This jira changes the
+    error message on the screen when cat a directory or a 
+    non-existent file. (hairong)
+
   NEW FEATURES
 
     HDFS-654. Add support new atomic rename functionality in HDFS for 

+ 1 - 1
src/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java

@@ -737,7 +737,7 @@ public class FSNamesystem implements FSConstants, FSNamesystemMBean, FSClusterSt
       throws IOException, UnresolvedLinkException {
     INodeFile inode = dir.getFileINode(src);
     if (inode == null)
-      throw new FileNotFoundException(src);
+      throw new FileNotFoundException("File does not exist: " + src);
     assert !inode.isLink();
     if (doAccessTime && isAccessTimeSupported()) {
       dir.setTimes(src, inode, -1, now(), false);

+ 8 - 8
src/test/hdfs/org/apache/hadoop/cli/testHDFSConf.xml

@@ -5194,7 +5194,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^cat: File does not exist: /file</expected-output>
+          <expected-output>^cat: java.io.FileNotFoundException: File does not exist: /file</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5209,7 +5209,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^cat: File does not exist: file</expected-output>
+          <expected-output>^cat: java.io.FileNotFoundException: File does not exist: /user/[a-z]*/file</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5226,7 +5226,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^cat: Source must be a file.</expected-output>
+          <expected-output>^cat: java.io.FileNotFoundException: File does not exist: /dir1</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5243,7 +5243,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^cat: File does not exist: dir</expected-output>
+          <expected-output>^cat: java.io.FileNotFoundException: File does not exist: /user/[a-z]*/dir</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5317,7 +5317,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^cat: File does not exist: hdfs:/file</expected-output>
+          <expected-output>^cat: java.io.FileNotFoundException: File does not exist: /file</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5334,7 +5334,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^cat: Source must be a file.</expected-output>
+          <expected-output>^cat: java.io.FileNotFoundException: File does not exist: /dir1</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5409,7 +5409,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^cat: File does not exist: hdfs://localhost[.a-z]*:[0-9]+/file</expected-output>
+          <expected-output>^cat: java.io.FileNotFoundException: File does not exist: /file</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -5426,7 +5426,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^cat: Source must be a file.</expected-output>
+          <expected-output>^cat: java.io.FileNotFoundException: File does not exist: /dir1</expected-output>
         </comparator>
       </comparators>
     </test>