Revert HADOOP-9692. This reverts commit 381610da620121c02073dbbaac669b80b41959b4. This reverts commit b5ca649bff01c906033d71c9f983b4cdaa71a9d1.
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/039a1f9e Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/039a1f9e Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/039a1f9e Branch: refs/heads/HDFS-8966 Commit: 039a1f9e968690cb66af224858e6e64b4f0b2926 Parents: cb282d5 Author: Tsuyoshi Ozawa <oz...@apache.org> Authored: Fri Oct 23 06:43:15 2015 +0900 Committer: Tsuyoshi Ozawa <oz...@apache.org> Committed: Fri Oct 23 06:48:26 2015 +0900 ---------------------------------------------------------------------- hadoop-common-project/hadoop-common/CHANGES.txt | 3 --- .../java/org/apache/hadoop/io/SequenceFile.java | 15 +++----------- .../org/apache/hadoop/io/TestSequenceFile.java | 21 -------------------- 3 files changed, 3 insertions(+), 36 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/039a1f9e/hadoop-common-project/hadoop-common/CHANGES.txt ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index 87ba2ba..0d3daa2 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -902,9 +902,6 @@ Release 2.8.0 - UNRELEASED HADOOP-10406. TestIPC.testIpcWithReaderQueuing may fail. (Xiao Chen via wang) - HADOOP-9692. Improving log message when SequenceFile reader throws - EOFException on zero-length file. Contributed by Zhe Zhang and Chu Tong. - OPTIMIZATIONS HADOOP-11785. Reduce the number of listStatus operation in distcp http://git-wip-us.apache.org/repos/asf/hadoop/blob/039a1f9e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/SequenceFile.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/SequenceFile.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/SequenceFile.java index ed57eee..e37e855 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/SequenceFile.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/SequenceFile.java @@ -1912,26 +1912,17 @@ public class SequenceFile { */ private void init(boolean tempReader) throws IOException { byte[] versionBlock = new byte[VERSION.length]; - String exceptionMsg = this + " not a SequenceFile"; - - // Try to read sequence file header. - try { - in.readFully(versionBlock); - } catch (EOFException e) { - throw new EOFException(exceptionMsg); - } + in.readFully(versionBlock); if ((versionBlock[0] != VERSION[0]) || (versionBlock[1] != VERSION[1]) || - (versionBlock[2] != VERSION[2])) { + (versionBlock[2] != VERSION[2])) throw new IOException(this + " not a SequenceFile"); - } // Set 'version' version = versionBlock[3]; - if (version > VERSION[3]) { + if (version > VERSION[3]) throw new VersionMismatchException(VERSION[3], version); - } if (version < BLOCK_COMPRESS_VERSION) { UTF8 className = new UTF8(); http://git-wip-us.apache.org/repos/asf/hadoop/blob/039a1f9e/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/TestSequenceFile.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/TestSequenceFile.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/TestSequenceFile.java index 99c97db..7495c6e 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/TestSequenceFile.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/TestSequenceFile.java @@ -522,27 +522,6 @@ public class TestSequenceFile extends TestCase { assertTrue("InputStream for " + path + " should have been closed.", openedFile[0].isClosed()); } - /** - * Test to makes sure zero length sequence file is handled properly while - * initializing. - */ - public void testInitZeroLengthSequenceFile() throws IOException { - Configuration conf = new Configuration(); - LocalFileSystem fs = FileSystem.getLocal(conf); - - // create an empty file (which is not a valid sequence file) - Path path = new Path(System.getProperty("test.build.data", ".") + - "/zerolength.seq"); - fs.create(path).close(); - - try { - new SequenceFile.Reader(conf, SequenceFile.Reader.file(path)); - fail("IOException expected."); - } catch (IOException expected) { - assertTrue(expected instanceof EOFException); - } - } - /** * Test that makes sure createWriter succeeds on a file that was * already created