|
@@ -22,6 +22,7 @@ import java.util.zip.*;
|
|
import org.apache.commons.logging.*;
|
|
import org.apache.commons.logging.*;
|
|
|
|
|
|
import org.apache.hadoop.conf.*;
|
|
import org.apache.hadoop.conf.*;
|
|
|
|
+import org.apache.hadoop.util.StringUtils;
|
|
|
|
|
|
/** Utility that wraps a {@link FSInputStream} in a {@link DataInputStream}
|
|
/** Utility that wraps a {@link FSInputStream} in a {@link DataInputStream}
|
|
* and buffers input through a {@link BufferedInputStream}. */
|
|
* and buffers input through a {@link BufferedInputStream}. */
|
|
@@ -48,7 +49,7 @@ public class FSDataInputStream extends DataInputStream {
|
|
|
|
|
|
this.fs = fs;
|
|
this.fs = fs;
|
|
this.file = file;
|
|
this.file = file;
|
|
- Path sumFile = fs.getChecksumFile(file);
|
|
|
|
|
|
+ Path sumFile = FileSystem.getChecksumFile(file);
|
|
try {
|
|
try {
|
|
this.sums = new FSDataInputStream(fs.openRaw(sumFile), conf);
|
|
this.sums = new FSDataInputStream(fs.openRaw(sumFile), conf);
|
|
byte[] version = new byte[VERSION.length];
|
|
byte[] version = new byte[VERSION.length];
|
|
@@ -59,7 +60,9 @@ public class FSDataInputStream extends DataInputStream {
|
|
} catch (FileNotFoundException e) { // quietly ignore
|
|
} catch (FileNotFoundException e) { // quietly ignore
|
|
stopSumming();
|
|
stopSumming();
|
|
} catch (IOException e) { // loudly ignore
|
|
} 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();
|
|
stopSumming();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -91,7 +94,15 @@ public class FSDataInputStream extends DataInputStream {
|
|
int inBuf = read - summed;
|
|
int inBuf = read - summed;
|
|
int toSum = inBuf <= goal ? inBuf : goal;
|
|
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;
|
|
summed += toSum;
|
|
|
|
|
|
inSum += toSum;
|
|
inSum += toSum;
|