hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From omal...@apache.org
Subject svn commit: r1077269 - in /hadoop/common/branches/branch-0.20-security-patches/src: core/org/apache/hadoop/fs/FsShell.java hdfs/org/apache/hadoop/hdfs/DFSClient.java test/org/apache/hadoop/cli/testConf.xml
Date Fri, 04 Mar 2011 03:58:15 GMT
Author: omalley
Date: Fri Mar  4 03:58:15 2011
New Revision: 1077269

URL: http://svn.apache.org/viewvc?rev=1077269&view=rev
Log:
commit 601e2f165a9ddfec67a75f02aad8ea3e4977dceb
Author: Hairong Kuang <hairong@ucdev21.inktomisearch.com>
Date:   Tue Mar 2 23:04:42 2010 +0000

    HADOOP:6569 from http://issues.apache.org/jira/secure/attachment/12437633/optimizeCat-yahoo2.patch
    
    +++ b/YAHOO-CHANGES.txt
    +    HADOOP-6569. FsShell#cat should avoid calling uneccessary getFileStatus
    +    before opening a file to read. (hairong)
    +

Modified:
    hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/fs/FsShell.java
    hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/DFSClient.java
    hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/cli/testConf.xml

Modified: hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/fs/FsShell.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/fs/FsShell.java?rev=1077269&r1=1077268&r2=1077269&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/fs/FsShell.java
(original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/fs/FsShell.java
Fri Mar  4 03:58:15 2011
@@ -333,7 +333,7 @@ public class FsShell extends Configured 
    * @exception: IOException
    * @see org.apache.hadoop.fs.FileSystem.globStatus 
    */
-  void cat(String src, boolean verifyChecksum) throws IOException {
+  void cat(final String src, boolean verifyChecksum) throws IOException {
     //cat behavior in Linux
     //  [~/1207]$ ls ?.txt
     //  x.txt  z.txt
@@ -346,9 +346,6 @@ public class FsShell extends Configured 
     new DelayedExceptionThrowing() {
       @Override
       void process(Path p, FileSystem srcFs) throws IOException {
-        if (srcFs.getFileStatus(p).isDir()) {
-          throw new IOException("Source must be a file.");
-        }
         printToStdout(srcFs.open(p));
       }
     }.globAndProcess(srcPattern, getSrcFileSystem(srcPattern, verifyChecksum));

Modified: hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/DFSClient.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/DFSClient.java?rev=1077269&r1=1077268&r2=1077269&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/DFSClient.java
(original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/hdfs/org/apache/hadoop/hdfs/DFSClient.java
Fri Mar  4 03:58:15 2011
@@ -1558,7 +1558,7 @@ public class DFSClient implements FSCons
     synchronized void openInfo() throws IOException {
       LocatedBlocks newInfo = callGetBlockLocations(namenode, src, 0, prefetchSize);
       if (newInfo == null) {
-        throw new IOException("Cannot open filename " + src);
+        throw new FileNotFoundException("File does not exist: " + src);
       }
 
       if (locatedBlocks != null) {

Modified: hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/cli/testConf.xml
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/cli/testConf.xml?rev=1077269&r1=1077268&r2=1077269&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/cli/testConf.xml
(original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/test/org/apache/hadoop/cli/testConf.xml
Fri Mar  4 03:58:15 2011
@@ -2314,7 +2314,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^cat: File does not exist: file</expected-output>
+          <expected-output>^cat: File does not exist: /user/[a-z]*/file</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -2331,7 +2331,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^cat: Source must be a file.</expected-output>
+          <expected-output>^cat: File does not exist: /dir1</expected-output>
         </comparator>
       </comparators>
     </test>
@@ -2348,7 +2348,7 @@
       <comparators>
         <comparator>
           <type>RegexpComparator</type>
-          <expected-output>^cat: File does not exist: dir</expected-output>
+          <expected-output>^cat: File does not exist: /user/[a-z]*/dir</expected-output>
         </comparator>
       </comparators>
     </test>



Mime
View raw message