hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zjs...@apache.org
Subject [10/50] [abbrv] hadoop git commit: MAPREDUCE-6225. Fix new findbug warnings in hadoop-mapreduce-client-core. Contributed by Varun Saxena
Date Wed, 18 Feb 2015 21:19:08 GMT
MAPREDUCE-6225. Fix new findbug warnings in hadoop-mapreduce-client-core. Contributed by Varun
Saxena


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

Branch: refs/heads/YARN-2928
Commit: 814afa46efef201cb782072432fc744e1cb9c463
Parents: 556386a
Author: Junping Du <junping_du@apache.org>
Authored: Mon Feb 16 09:38:05 2015 -0800
Committer: Junping Du <junping_du@apache.org>
Committed: Mon Feb 16 09:38:05 2015 -0800

----------------------------------------------------------------------
 hadoop-mapreduce-project/CHANGES.txt                 |  3 +++
 .../java/org/apache/hadoop/mapred/IndexCache.java    |  2 +-
 .../org/apache/hadoop/mapred/TaskLogAppender.java    |  2 +-
 .../hadoop/mapred/lib/CombineFileRecordReader.java   |  5 -----
 .../org/apache/hadoop/mapreduce/JobSubmitter.java    | 15 ++++++---------
 .../mapreduce/lib/fieldsel/FieldSelectionHelper.java |  2 +-
 .../mapreduce/lib/input/CombineFileRecordReader.java |  5 -----
 .../mapreduce/security/SecureShuffleUtils.java       | 15 ++++++++++-----
 .../hadoop/mapreduce/task/reduce/InMemoryReader.java |  4 +---
 .../hadoop/mapreduce/util/ResourceBundles.java       |  2 +-
 10 files changed, 24 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/814afa46/hadoop-mapreduce-project/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt
index bb9e105..9ef7a32 100644
--- a/hadoop-mapreduce-project/CHANGES.txt
+++ b/hadoop-mapreduce-project/CHANGES.txt
@@ -294,6 +294,9 @@ Release 2.7.0 - UNRELEASED
     MAPREDUCE-6256. Removed unused private methods in o.a.h.mapreduce.Job.java.
     (Naganarasimha G R via ozawa)
 
+    MAPREDUCE-6225. Fix new findbug warnings in hadoop-mapreduce-client-core. 
+    (Varun Saxena via junping_du)
+
   OPTIMIZATIONS
 
     MAPREDUCE-6169. MergeQueue should release reference to the current item 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/814afa46/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/IndexCache.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/IndexCache.java
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/IndexCache.java
index 54add3a..c3db951 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/IndexCache.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/IndexCache.java
@@ -145,7 +145,7 @@ class IndexCache {
    */
   public void removeMap(String mapId) {
     IndexInformation info = cache.get(mapId);
-    if (info == null || ((info != null) && isUnderConstruction(info))) {
+    if (info == null || isUnderConstruction(info)) {
       return;
     }
     info = cache.remove(mapId);

http://git-wip-us.apache.org/repos/asf/hadoop/blob/814afa46/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/TaskLogAppender.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/TaskLogAppender.java
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/TaskLogAppender.java
index 2162a26..d10b764 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/TaskLogAppender.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/TaskLogAppender.java
@@ -75,7 +75,7 @@ public class TaskLogAppender extends FileAppender implements Flushable {
 
     if (maxEvents == null) {
       String propValue = System.getProperty(LOGSIZE_PROPERTY, "0");
-      setTotalLogFileSize(Long.valueOf(propValue));
+      setTotalLogFileSize(Long.parseLong(propValue));
     }
   }
   

http://git-wip-us.apache.org/repos/asf/hadoop/blob/814afa46/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/CombineFileRecordReader.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/CombineFileRecordReader.java
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/CombineFileRecordReader.java
index f54f176..a25eb29 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/CombineFileRecordReader.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/lib/CombineFileRecordReader.java
@@ -21,8 +21,6 @@ package org.apache.hadoop.mapred.lib;
 import java.io.*;
 import java.lang.reflect.*;
 
-import org.apache.hadoop.fs.FileSystem;
-
 import org.apache.hadoop.mapred.*;
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.classification.InterfaceStability;
@@ -49,9 +47,7 @@ public class CombineFileRecordReader<K, V> implements RecordReader<K,
V> {
   protected CombineFileSplit split;
   protected JobConf jc;
   protected Reporter reporter;
-  protected Class<RecordReader<K, V>> rrClass;
   protected Constructor<RecordReader<K, V>> rrConstructor;
-  protected FileSystem fs;
   
   protected int idx;
   protected long progress;
@@ -106,7 +102,6 @@ public class CombineFileRecordReader<K, V> implements RecordReader<K,
V> {
     throws IOException {
     this.split = split;
     this.jc = job;
-    this.rrClass = rrClass;
     this.reporter = reporter;
     this.idx = 0;
     this.curReader = null;

http://git-wip-us.apache.org/repos/asf/hadoop/blob/814afa46/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/JobSubmitter.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/JobSubmitter.java
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/JobSubmitter.java
index ba496ee..75357f7 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/JobSubmitter.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/JobSubmitter.java
@@ -390,10 +390,12 @@ class JobSubmitter {
     short replication = (short)conf.getInt(Job.SUBMIT_REPLICATION, 10);
     copyAndConfigureFiles(job, jobSubmitDir, replication);
 
-    // Set the working directory
-    if (job.getWorkingDirectory() == null) {
-      job.setWorkingDirectory(jtFs.getWorkingDirectory());
-    }
+    // Get the working directory. If not set, sets it to filesystem working dir
+    // This code has been added so that working directory reset before running
+    // the job. This is necessary for backward compatibility as other systems
+    // might use the public API JobConf#setWorkingDirectory to reset the working
+    // directory.
+    job.getWorkingDirectory();
 
   }
   /**
@@ -773,11 +775,6 @@ class JobSubmitter {
     if (!log4jPropertyFile.isEmpty()) {
       short replication = (short)conf.getInt(Job.SUBMIT_REPLICATION, 10);
       copyLog4jPropertyFile(job, jobSubmitDir, replication);
-
-      // Set the working directory
-      if (job.getWorkingDirectory() == null) {
-        job.setWorkingDirectory(jtFs.getWorkingDirectory());
-      }
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/814afa46/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/fieldsel/FieldSelectionHelper.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/fieldsel/FieldSelectionHelper.java
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/fieldsel/FieldSelectionHelper.java
index 11d6ee2..6e22fe9 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/fieldsel/FieldSelectionHelper.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/fieldsel/FieldSelectionHelper.java
@@ -90,7 +90,7 @@ public class FieldSelectionHelper {
       }
       pos = fieldSpec.indexOf('-');
       if (pos < 0) {
-        Integer fn = new Integer(fieldSpec);
+        Integer fn = Integer.valueOf(fieldSpec);
         fieldList.add(fn);
       } else {
         String start = fieldSpec.substring(0, pos);

http://git-wip-us.apache.org/repos/asf/hadoop/blob/814afa46/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/input/CombineFileRecordReader.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/input/CombineFileRecordReader.java
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/input/CombineFileRecordReader.java
index 767f79a..f71b946 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/input/CombineFileRecordReader.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/lib/input/CombineFileRecordReader.java
@@ -21,8 +21,6 @@ package org.apache.hadoop.mapreduce.lib.input;
 import java.io.*;
 import java.lang.reflect.*;
 
-import org.apache.hadoop.fs.FileSystem;
-
 import org.apache.hadoop.mapreduce.*;
 import org.apache.hadoop.classification.InterfaceAudience;
 import org.apache.hadoop.classification.InterfaceStability;
@@ -46,9 +44,7 @@ public class CombineFileRecordReader<K, V> extends RecordReader<K,
V> {
                                           Integer.class};
 
   protected CombineFileSplit split;
-  protected Class<? extends RecordReader<K,V>> rrClass;
   protected Constructor<? extends RecordReader<K,V>> rrConstructor;
-  protected FileSystem fs;
   protected TaskAttemptContext context;
   
   protected int idx;
@@ -111,7 +107,6 @@ public class CombineFileRecordReader<K, V> extends RecordReader<K,
V> {
     throws IOException {
     this.split = split;
     this.context = context;
-    this.rrClass = rrClass;
     this.idx = 0;
     this.curReader = null;
     this.progress = 0;

http://git-wip-us.apache.org/repos/asf/hadoop/blob/814afa46/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/security/SecureShuffleUtils.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/security/SecureShuffleUtils.java
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/security/SecureShuffleUtils.java
index 040a3e3..60919d0 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/security/SecureShuffleUtils.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/security/SecureShuffleUtils.java
@@ -21,8 +21,8 @@ package org.apache.hadoop.mapreduce.security;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.PrintStream;
+import java.io.UnsupportedEncodingException;
 import java.net.URL;
-
 import javax.crypto.SecretKey;
 import javax.servlet.http.HttpServletRequest;
 
@@ -141,10 +141,15 @@ public class SecureShuffleUtils {
    */
   public static String toHex(byte[] ba) {
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
-    PrintStream ps = new PrintStream(baos);
-    for (byte b : ba) {
-      ps.printf("%x", b);
+    String strHex = "";
+    try {
+      PrintStream ps = new PrintStream(baos, false, "UTF-8");
+      for (byte b : ba) {
+        ps.printf("%x", b);
+      }
+      strHex = baos.toString("UTF-8");
+    } catch (UnsupportedEncodingException e) {
     }
-    return baos.toString();
+    return strHex;
   }
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/814afa46/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/task/reduce/InMemoryReader.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/task/reduce/InMemoryReader.java
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/task/reduce/InMemoryReader.java
index b246d24..8a6ab44 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/task/reduce/InMemoryReader.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/task/reduce/InMemoryReader.java
@@ -79,10 +79,8 @@ public class InMemoryReader<K, V> extends Reader<K, V> {
     File dumpFile = new File("../output/" + taskAttemptId + ".dump");
     System.err.println("Dumping corrupt map-output of " + taskAttemptId + 
                        " to " + dumpFile.getAbsolutePath());
-    try {
-      FileOutputStream fos = new FileOutputStream(dumpFile);
+    try (FileOutputStream fos = new FileOutputStream(dumpFile)) {
       fos.write(buffer, 0, bufferSize);
-      fos.close();
     } catch (IOException ioe) {
       System.err.println("Failed to dump map-output of " + taskAttemptId);
     }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/814afa46/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/util/ResourceBundles.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/util/ResourceBundles.java
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/util/ResourceBundles.java
index 52addcf..4a11740 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/util/ResourceBundles.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/util/ResourceBundles.java
@@ -59,7 +59,7 @@ public class ResourceBundles {
     catch (Exception e) {
       return defaultValue;
     }
-    return value == null ? defaultValue : value;
+    return value;
   }
 
   private static String getLookupKey(String key, String suffix) {


Mime
View raw message