hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject svn commit: r1304963 - in /hadoop/common/branches/branch-1: CHANGES.txt src/mapred/org/apache/hadoop/mapred/ReduceTask.java
Date Sat, 24 Mar 2012 23:38:08 GMT
Author: todd
Date: Sat Mar 24 23:38:07 2012
New Revision: 1304963

URL: http://svn.apache.org/viewvc?rev=1304963&view=rev
Log:
MAPREDUCE-3992. Reduce fetcher doesn't verify HTTP status code of response. Contributed by
Todd Lipcon.

Modified:
    hadoop/common/branches/branch-1/CHANGES.txt
    hadoop/common/branches/branch-1/src/mapred/org/apache/hadoop/mapred/ReduceTask.java

Modified: hadoop/common/branches/branch-1/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/CHANGES.txt?rev=1304963&r1=1304962&r2=1304963&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/CHANGES.txt (original)
+++ hadoop/common/branches/branch-1/CHANGES.txt Sat Mar 24 23:38:07 2012
@@ -106,6 +106,9 @@ Release 1.1.0 - unreleased
     HADOOP-8154. DNS#getIPs shouldn't silently return the local host
     IP for bogus interface names. (eli)
 
+    MAPREDUCE-3992. Reduce fetcher doesn't verify HTTP status code of response
+    (todd)
+
   IMPROVEMENTS
 
     MAPREDUCE-3597. [Rumen] Provide a way to access other info of history file

Modified: hadoop/common/branches/branch-1/src/mapred/org/apache/hadoop/mapred/ReduceTask.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/src/mapred/org/apache/hadoop/mapred/ReduceTask.java?rev=1304963&r1=1304962&r2=1304963&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/src/mapred/org/apache/hadoop/mapred/ReduceTask.java (original)
+++ hadoop/common/branches/branch-1/src/mapred/org/apache/hadoop/mapred/ReduceTask.java Sat
Mar 24 23:38:07 2012
@@ -24,6 +24,7 @@ import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.net.HttpURLConnection;
 import java.net.URI;
 import java.net.URL;
 import java.net.URLClassLoader;
@@ -1482,9 +1483,17 @@ class ReduceTask extends Task {
       throws IOException, InterruptedException {
         // Connect
         URL url = mapOutputLoc.getOutputLocation();
-        URLConnection connection = url.openConnection();
+        HttpURLConnection connection = (HttpURLConnection)url.openConnection();
         
         InputStream input = setupSecureConnection(mapOutputLoc, connection);
+
+        // Validate response code
+        int rc = connection.getResponseCode();
+        if (rc != HttpURLConnection.HTTP_OK) {
+          throw new IOException(
+              "Got invalid response code " + rc + " from " + url +
+              ": " + connection.getResponseMessage());
+        }
  
         // Validate header from map output
         TaskAttemptID mapId = null;



Mime
View raw message