hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r425327 - /lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FSDataInputStream.java
Date Tue, 25 Jul 2006 08:27:41 GMT
Author: cutting
Date: Tue Jul 25 01:27:41 2006
New Revision: 425327

URL: http://svn.apache.org/viewvc?rev=425327&view=rev
Log:
HADOOP-384.  Improved error messages for checksum problems.  Contributed by Owen.

Modified:
    lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FSDataInputStream.java

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FSDataInputStream.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FSDataInputStream.java?rev=425327&r1=425326&r2=425327&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FSDataInputStream.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/fs/FSDataInputStream.java Tue Jul 25 01:27:41
2006
@@ -22,6 +22,7 @@
 import org.apache.commons.logging.*;
 
 import org.apache.hadoop.conf.*;
+import org.apache.hadoop.util.StringUtils;
 
 /** Utility that wraps a {@link FSInputStream} in a {@link DataInputStream}
  * and buffers input through a {@link BufferedInputStream}. */
@@ -48,7 +49,7 @@
       
       this.fs = fs;
       this.file = file;
-      Path sumFile = fs.getChecksumFile(file);
+      Path sumFile = FileSystem.getChecksumFile(file);
       try {
         this.sums = new FSDataInputStream(fs.openRaw(sumFile), conf);
         byte[] version = new byte[VERSION.length];
@@ -59,7 +60,9 @@
       } catch (FileNotFoundException e) {         // quietly ignore
         stopSumming();
       } catch (IOException e) {                   // loudly ignore
-        LOG.warn("Problem opening checksum file: "+ file + ".  Ignoring with exception "
+ e + ".");
+        LOG.warn("Problem opening checksum file: "+ file + 
+                 ".  Ignoring exception: " + 
+                 StringUtils.stringifyException(e));
         stopSumming();
       }
     }
@@ -91,7 +94,15 @@
           int inBuf = read - summed;
           int toSum = inBuf <= goal ? inBuf : goal;
           
-          sum.update(b, off+summed, toSum);
+          try {
+            sum.update(b, off+summed, toSum);
+          } catch (ArrayIndexOutOfBoundsException e) {
+            throw new RuntimeException("Summer buffer overflow b.len=" + 
+                                       b.length + ", off=" + off + 
+                                       ", summed=" + summed + ", read=" + 
+                                       read + ", bytesPerSum=" + bytesPerSum +
+                                       ", inSum=" + inSum, e);
+          }
           summed += toSum;
           
           inSum += toSum;



Mime
View raw message