Author: dhruba Date: Tue Dec 18 07:00:05 2007 New Revision: 605220 URL: http://svn.apache.org/viewvc?rev=605220&view=rev Log: HADOOP-2422. dfs -cat multiple files fail with 'Unable to write to output stream'. (Raghu Angadi via dhruba)
Modified: lucene/hadoop/trunk/CHANGES.txt lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FsShell.java lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/TestDFSShell.java Modified: lucene/hadoop/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?rev=605220&r1=605219&r2=605220&view=diff ============================================================================== --- lucene/hadoop/trunk/CHANGES.txt (original) +++ lucene/hadoop/trunk/CHANGES.txt Tue Dec 18 07:00:05 2007 @@ -314,6 +314,8 @@ by HADOOP-1917 weren't correctly copied over to the trunk/docs directory. Also fixed a couple of minor typos and broken links. (acmurthy) + HADOOP-2422. dfs -cat multiple files fail with 'Unable to write to + output stream'. (Raghu Angadi via dhruba) Release 0.15.0 - 2007-11-2 Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FsShell.java URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FsShell.java?rev=605220&r1=605219&r2=605220&view=diff ============================================================================== --- lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FsShell.java (original) +++ lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FsShell.java Tue Dec 18 07:00:05 2007 @@ -101,7 +101,11 @@ * Print from src to stdout. */ private void printToStdout(InputStream in) throws IOException { - IOUtils.copyBytes(in, System.out, getConf(), true); + try { + IOUtils.copyBytes(in, System.out, getConf(), false); + } finally { + in.close(); + } } /** Modified: lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/TestDFSShell.java URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/TestDFSShell.java?rev=605220&r1=605219&r2=605220&view=diff ============================================================================== --- lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/TestDFSShell.java (original) +++ lucene/hadoop/trunk/src/test/org/apache/hadoop/dfs/TestDFSShell.java Tue Dec 18 07:00:05 2007 @@ -329,12 +329,16 @@ Path myFile = new Path("/test/mkdirs/myFile"); writeFile(fileSys, myFile); assertTrue(fileSys.exists(myFile)); + Path myFile2 = new Path("/test/mkdirs/myFile2"); + writeFile(fileSys, myFile2); + assertTrue(fileSys.exists(myFile2)); // Verify that we can read the file { - String[] args = new String[2]; + String[] args = new String[3]; args[0] = "-cat"; args[1] = "/test/mkdirs/myFile"; + args[2] = "/test/mkdirs/myFile2"; int val = -1; try { val = shell.run(args); @@ -344,6 +348,7 @@ } assertTrue(val == 0); } + fileSys.delete(myFile2); // Verify that we can get with and without crc {