hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1126288 - in /hadoop/common/branches/branch-0.22: ./ src/docs/ src/java/ src/java/org/apache/hadoop/io/ src/test/core/ src/test/core/org/apache/hadoop/io/
Date Mon, 23 May 2011 01:29:02 GMT
Author: eli
Date: Mon May 23 01:29:01 2011
New Revision: 1126288

URL: http://svn.apache.org/viewvc?rev=1126288&view=rev
Log:
HADOOP-7318. svn merge -c 1126287 from trunk

Modified:
    hadoop/common/branches/branch-0.22/   (props changed)
    hadoop/common/branches/branch-0.22/CHANGES.txt   (contents, props changed)
    hadoop/common/branches/branch-0.22/src/docs/   (props changed)
    hadoop/common/branches/branch-0.22/src/java/   (props changed)
    hadoop/common/branches/branch-0.22/src/java/org/apache/hadoop/io/MD5Hash.java
    hadoop/common/branches/branch-0.22/src/test/core/   (props changed)
    hadoop/common/branches/branch-0.22/src/test/core/org/apache/hadoop/io/TestMD5Hash.java
    hadoop/common/branches/branch-0.22/src/test/core/org/apache/hadoop/io/TestSequenceFile.java
  (props changed)

Propchange: hadoop/common/branches/branch-0.22/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May 23 01:29:01 2011
@@ -1,2 +1,2 @@
-/hadoop/common/trunk:1037901,1039952,1040408,1040849,1044490,1050070,1054848,1054853,1054903,1058881,1065858,1070021,1071021,1071084,1080797,1095958,1096522,1100044,1100048,1100056,1102914,1103931,1124456
+/hadoop/common/trunk:1037901,1039952,1040408,1040849,1044490,1050070,1054848,1054853,1054903,1058881,1065858,1070021,1071021,1071084,1080797,1095958,1096522,1100044,1100048,1100056,1102914,1103931,1124456,1126287
 /hadoop/core/branches/branch-0.19/core:713112

Modified: hadoop/common/branches/branch-0.22/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.22/CHANGES.txt?rev=1126288&r1=1126287&r2=1126288&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.22/CHANGES.txt (original)
+++ hadoop/common/branches/branch-0.22/CHANGES.txt Mon May 23 01:29:01 2011
@@ -483,6 +483,9 @@ Release 0.22.0 - Unreleased
     HADOOP-7305. Eclipse project classpath should include tools.jar from JDK.
     (Niels Basjes via todd)
 
+    HADOOP-7318. MD5Hash factory should reset the digester it returns.
+    (todd via eli)
+
 Release 0.21.1 - Unreleased
 
   IMPROVEMENTS

Propchange: hadoop/common/branches/branch-0.22/CHANGES.txt
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May 23 01:29:01 2011
@@ -1,4 +1,4 @@
-/hadoop/common/trunk/CHANGES.txt:1037901,1039952,1040408,1040849,1044490,1050070,1054848,1054853,1054903,1058881,1065858,1070021,1071021,1071084,1080797,1095958,1096522,1100044,1100048,1100056,1102914,1103931,1124456
+/hadoop/common/trunk/CHANGES.txt:1037901,1039952,1040408,1040849,1044490,1050070,1054848,1054853,1054903,1058881,1065858,1070021,1071021,1071084,1080797,1095958,1096522,1100044,1100048,1100056,1102914,1103931,1124456,1126287
 /hadoop/core/branches/branch-0.18/CHANGES.txt:727226
 /hadoop/core/branches/branch-0.19/CHANGES.txt:713112
 /hadoop/core/trunk/CHANGES.txt:776175-785643,785929-786278

Propchange: hadoop/common/branches/branch-0.22/src/docs/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May 23 01:29:01 2011
@@ -1,2 +1,2 @@
-/hadoop/common/trunk/src/docs:1037901,1039952,1040408,1040849,1044490,1050070,1054848,1054853,1054903,1058881,1065858,1070021,1071021,1071084,1080797,1095958,1096522,1100044,1100048,1100056,1102914,1103931,1124456
+/hadoop/common/trunk/src/docs:1037901,1039952,1040408,1040849,1044490,1050070,1054848,1054853,1054903,1058881,1065858,1070021,1071021,1071084,1080797,1095958,1096522,1100044,1100048,1100056,1102914,1103931,1124456,1126287
 /hadoop/core/branches/branch-0.19/src/docs:713112

Propchange: hadoop/common/branches/branch-0.22/src/java/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May 23 01:29:01 2011
@@ -1,3 +1,3 @@
-/hadoop/common/trunk/src/java:1037901,1039952,1040408,1040849,1044490,1050070,1054848,1054853,1054903,1058881,1065858,1070021,1071021,1071084,1080797,1095958,1096522,1100044,1100048,1100056,1102914,1103931,1124456
+/hadoop/common/trunk/src/java:1037901,1039952,1040408,1040849,1044490,1050070,1054848,1054853,1054903,1058881,1065858,1070021,1071021,1071084,1080797,1095958,1096522,1100044,1100048,1100056,1102914,1103931,1124456,1126287
 /hadoop/core/branches/branch-0.19/core/src/java:713112
 /hadoop/core/trunk/src/core:776175-785643,785929-786278

Modified: hadoop/common/branches/branch-0.22/src/java/org/apache/hadoop/io/MD5Hash.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.22/src/java/org/apache/hadoop/io/MD5Hash.java?rev=1126288&r1=1126287&r2=1126288&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.22/src/java/org/apache/hadoop/io/MD5Hash.java (original)
+++ hadoop/common/branches/branch-0.22/src/java/org/apache/hadoop/io/MD5Hash.java Mon May
23 01:29:01 2011
@@ -98,7 +98,9 @@ public class MD5Hash implements Writable
    * Create a thread local MD5 digester
    */
   public static MessageDigest getDigester() {
-    return DIGESTER_FACTORY.get();
+    MessageDigest digester = DIGESTER_FACTORY.get();
+    digester.reset();
+    return digester;
   }
 
   /** Construct a hash value for the content from the InputStream. */

Propchange: hadoop/common/branches/branch-0.22/src/test/core/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May 23 01:29:01 2011
@@ -1,3 +1,3 @@
-/hadoop/common/trunk/src/test/core:1037901,1039952,1040408,1040849,1044490,1050070,1054848,1054853,1054903,1058881,1065858,1070021,1071021,1071084,1080797,1095958,1096522,1100044,1100048,1100056,1102914,1103931,1124456
+/hadoop/common/trunk/src/test/core:1037901,1039952,1040408,1040849,1044490,1050070,1054848,1054853,1054903,1058881,1065858,1070021,1071021,1071084,1080797,1095958,1096522,1100044,1100048,1100056,1102914,1103931,1124456,1126287
 /hadoop/core/branches/branch-0.19/core/src/test/core:713112
 /hadoop/core/trunk/src/test/core:776175-785643,785929-786278

Modified: hadoop/common/branches/branch-0.22/src/test/core/org/apache/hadoop/io/TestMD5Hash.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.22/src/test/core/org/apache/hadoop/io/TestMD5Hash.java?rev=1126288&r1=1126287&r2=1126288&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.22/src/test/core/org/apache/hadoop/io/TestMD5Hash.java
(original)
+++ hadoop/common/branches/branch-0.22/src/test/core/org/apache/hadoop/io/TestMD5Hash.java
Mon May 23 01:29:01 2011
@@ -20,6 +20,9 @@ package org.apache.hadoop.io;
 
 import org.apache.hadoop.io.TestWritable;
 import junit.framework.TestCase;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
 import java.security.MessageDigest;
 import java.util.Random;
 
@@ -109,7 +112,38 @@ public class TestMD5Hash extends TestCas
     t2.start();
     t1.join();
     t2.join();
-    
   }
-	
+
+  public void testFactoryReturnsClearedHashes() throws IOException {
+    // A stream that will throw an IOE after reading some bytes
+    ByteArrayInputStream failingStream = new ByteArrayInputStream(
+        "xxxx".getBytes()) {
+      @Override
+      public synchronized int read(byte[] b) throws IOException {
+        int ret = super.read(b);
+        if (ret <= 0) {
+          throw new IOException("Injected fault");
+        }
+        return ret;
+      }
+    };
+    final String TEST_STRING = "hello";
+
+    // Calculate the correct digest for the test string
+    MD5Hash expectedHash = MD5Hash.digest(TEST_STRING);
+
+    // Hashing again should give the same result
+    assertEquals(expectedHash, MD5Hash.digest(TEST_STRING));
+
+    // Try to hash a stream which will fail halfway through
+    try {
+      MD5Hash.digest(failingStream);
+      fail("didnt throw!");
+    } catch (Exception e) {
+      // expected
+    }
+
+    // Make sure we get the same result
+    assertEquals(expectedHash, MD5Hash.digest(TEST_STRING));
+  }
 }

Propchange: hadoop/common/branches/branch-0.22/src/test/core/org/apache/hadoop/io/TestSequenceFile.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon May 23 01:29:01 2011
@@ -1,3 +1,3 @@
-/hadoop/common/trunk/src/test/core/org/apache/hadoop/io/TestSequenceFile.java:1037901,1039952,1040408,1040849,1044490,1050070,1054848,1054853,1054903,1058881,1065858,1070021,1071021,1071084,1080797,1095958,1096522,1100044,1100048,1100056,1102914,1103931,1124456
+/hadoop/common/trunk/src/test/core/org/apache/hadoop/io/TestSequenceFile.java:1037901,1039952,1040408,1040849,1044490,1050070,1054848,1054853,1054903,1058881,1065858,1070021,1071021,1071084,1080797,1095958,1096522,1100044,1100048,1100056,1102914,1103931,1124456,1126287
 /hadoop/core/branches/branch-0.19/mapred/src/test/mapred/org/apache/hadoop/io/TestSequenceFile.java:713112
 /hadoop/core/trunk/src/test/mapred/org/apache/hadoop/io/TestSequenceFile.java:776175-785643



Mime
View raw message