hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From omal...@apache.org
Subject svn commit: r1079190 - /hadoop/mapreduce/branches/yahoo-merge/src/examples/org/apache/hadoop/examples/terasort/TeraInputFormat.java
Date Tue, 08 Mar 2011 05:53:41 GMT
Author: omalley
Date: Tue Mar  8 05:53:41 2011
New Revision: 1079190

URL: http://svn.apache.org/viewvc?rev=1079190&view=rev
Log:
commit 4e6ee89ca1c8c3a868ad2a6a004a11b1259548fc
Author: Richard King <dking@yahoo-inc.com>
Date:   Thu Nov 25 01:11:51 2010 +0000

    fixes NPE within TestTeraSort
    
    +++ b/YAHOO-CHANGES.txt
    +
    +  Bug 4171528 -- NPE within TestTeraSort (dking)
    +  from
    +

Modified:
    hadoop/mapreduce/branches/yahoo-merge/src/examples/org/apache/hadoop/examples/terasort/TeraInputFormat.java

Modified: hadoop/mapreduce/branches/yahoo-merge/src/examples/org/apache/hadoop/examples/terasort/TeraInputFormat.java
URL: http://svn.apache.org/viewvc/hadoop/mapreduce/branches/yahoo-merge/src/examples/org/apache/hadoop/examples/terasort/TeraInputFormat.java?rev=1079190&r1=1079189&r2=1079190&view=diff
==============================================================================
--- hadoop/mapreduce/branches/yahoo-merge/src/examples/org/apache/hadoop/examples/terasort/TeraInputFormat.java
(original)
+++ hadoop/mapreduce/branches/yahoo-merge/src/examples/org/apache/hadoop/examples/terasort/TeraInputFormat.java
Tue Mar  8 05:53:41 2011
@@ -61,19 +61,32 @@ public class TeraInputFormat extends Fil
   private static List<InputSplit> lastResult = null;
 
   static class TeraFileSplit extends FileSplit {
+    static private String[] ZERO_LOCATIONS = new String[0];
+
     private String[] locations;
-    public TeraFileSplit() {}
+
+    public TeraFileSplit() {
+      locations = ZERO_LOCATIONS;
+    }
     public TeraFileSplit(Path file, long start, long length, String[] hosts) {
       super(file, start, length, hosts);
-      locations = hosts;
+      try {
+        locations = super.getLocations();
+      } catch (IOException e) {
+        locations = ZERO_LOCATIONS;
+      }
     }
+
+    // XXXXXX should this also be null-protected?
     protected void setLocations(String[] hosts) {
       locations = hosts;
     }
+
     @Override
     public String[] getLocations() {
       return locations;
     }
+
     public String toString() {
       StringBuffer result = new StringBuffer();
       result.append(getPath());



Mime
View raw message