You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by um...@apache.org on 2015/12/09 07:40:08 UTC

hadoop git commit: HADOOP-12618. Fix NPE in TestSequenceFile. (Brahma Reddy Battula via umamahesh)

Repository: hadoop
Updated Branches:
  refs/heads/trunk a5e2e1ecb -> ad53c5206


HADOOP-12618. Fix NPE in TestSequenceFile. (Brahma Reddy Battula via umamahesh)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/ad53c520
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/ad53c520
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/ad53c520

Branch: refs/heads/trunk
Commit: ad53c520630847834b3e68b7f41aa88ee10b3300
Parents: a5e2e1e
Author: Uma Mahesh <um...@apache.org>
Authored: Tue Dec 8 22:39:17 2015 -0800
Committer: Uma Mahesh <um...@apache.org>
Committed: Tue Dec 8 22:39:17 2015 -0800

----------------------------------------------------------------------
 hadoop-common-project/hadoop-common/CHANGES.txt    |  2 ++
 .../org/apache/hadoop/io/TestSequenceFile.java     | 17 +++++++++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/ad53c520/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 0f505dd..6bd6267 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -1000,6 +1000,8 @@ Release 2.8.0 - UNRELEASED
     HADOOP-12600. FileContext and AbstractFileSystem should be annotated as a
     Stable interface. (cnauroth)
 
+    HADOOP-12618. Fix NPE in TestSequenceFile. (Brahma Reddy Battula via umamahesh)
+
   OPTIMIZATIONS
 
     HADOOP-11785. Reduce the number of listStatus operation in distcp

http://git-wip-us.apache.org/repos/asf/hadoop/blob/ad53c520/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 e127928..4cb4e13 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
@@ -130,6 +130,7 @@ public class TestSequenceFile {
     }
   }
 
+  @SuppressWarnings("deprecation")
   private void writeTest(FileSystem fs, int count, int seed, Path file, 
                                 CompressionType compressionType, CompressionCodec codec)
     throws IOException {
@@ -150,6 +151,7 @@ public class TestSequenceFile {
     writer.close();
   }
 
+  @SuppressWarnings("deprecation")
   private void readTest(FileSystem fs, int count, int seed, Path file)
     throws IOException {
     LOG.debug("reading " + count + " records");
@@ -216,6 +218,7 @@ public class TestSequenceFile {
     LOG.info("done sorting " + count + " debug");
   }
 
+  @SuppressWarnings("deprecation")
   private void checkSort(FileSystem fs, int count, int seed, Path file)
     throws IOException {
     LOG.info("sorting " + count + " records in memory for debug");
@@ -253,6 +256,7 @@ public class TestSequenceFile {
     LOG.debug("sucessfully checked " + count + " records");
   }
 
+  @SuppressWarnings("deprecation")
   private void mergeTest(FileSystem fs, int count, int seed, Path file, 
                                 CompressionType compressionType,
                                 boolean fast, int factor, int megabytes)
@@ -375,6 +379,7 @@ public class TestSequenceFile {
   }
   
   
+  @SuppressWarnings("deprecation")
   private SequenceFile.Metadata readMetadata(FileSystem fs, Path file)
     throws IOException {
     LOG.info("reading file: " + file.toString());
@@ -384,6 +389,7 @@ public class TestSequenceFile {
     return meta;
   }
 
+  @SuppressWarnings("deprecation")
   private void writeMetadataTest(FileSystem fs, int count, int seed, Path file, 
                                         CompressionType compressionType, CompressionCodec codec, SequenceFile.Metadata metadata)
     throws IOException {
@@ -413,6 +419,7 @@ public class TestSequenceFile {
     sorter.sort(new Path[] { unsortedFile }, sortedFile, false);
   }
 
+  @SuppressWarnings("deprecation")
   @Test
   public void testClose() throws IOException {
     Configuration conf = new Configuration();
@@ -470,6 +477,7 @@ public class TestSequenceFile {
    * Test that makes sure the FileSystem passed to createWriter
    * @throws Exception
    */
+  @SuppressWarnings("deprecation")
   @Test
   public void testCreateUsesFsArg() throws Exception {
     FileSystem fs = FileSystem.getLocal(conf);
@@ -499,6 +507,7 @@ public class TestSequenceFile {
     }
   }
 
+  @SuppressWarnings("deprecation")
   @Test
   public void testCloseForErroneousSequenceFile()
     throws IOException {
@@ -555,6 +564,7 @@ public class TestSequenceFile {
    * already created
    * @throws IOException
    */
+  @SuppressWarnings("deprecation")
   @Test
   public void testCreateWriterOnExistingFile() throws IOException {
     Configuration conf = new Configuration();
@@ -568,6 +578,7 @@ public class TestSequenceFile {
         CompressionType.NONE, null, new Metadata());
   }
 
+  @SuppressWarnings("deprecation")
   @Test
   public void testRecursiveSeqFileCreate() throws IOException {
     FileSystem fs = FileSystem.getLocal(conf);
@@ -661,7 +672,7 @@ public class TestSequenceFile {
     Path file = null;
     int seed = new Random().nextInt();
 
-    String usage = "Usage: SequenceFile " +
+    String usage = "Usage: testsequencefile " +
       "[-count N] " + 
       "[-seed #] [-check] [-compressType <NONE|RECORD|BLOCK>] " + 
       "-codec <compressionCodec> " + 
@@ -751,7 +762,9 @@ public class TestSequenceFile {
         test.checkSort(fs, count, seed, file);
       }
     } finally {
-      fs.close();
+      if (fs != null) {
+        fs.close();
+      }
     }
   }
 }