|
|
@ -335,11 +335,11 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator { |
|
|
|
|
|
|
|
|
|
|
|
private InputStream possiblyFilteredInputStream(final Entry e, |
|
|
|
private InputStream possiblyFilteredInputStream(final Entry e, |
|
|
|
final InputStream is, final long len) throws IOException { |
|
|
|
final InputStream is, final long len) throws IOException { |
|
|
|
InputStream filteredIs; |
|
|
|
|
|
|
|
if (!mightNeedCleaning()) { |
|
|
|
if (!mightNeedCleaning()) { |
|
|
|
filteredIs = is; |
|
|
|
|
|
|
|
canonLen = len; |
|
|
|
canonLen = len; |
|
|
|
} else { |
|
|
|
return is; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (len <= MAXIMUM_FILE_SIZE_TO_READ_FULLY) { |
|
|
|
if (len <= MAXIMUM_FILE_SIZE_TO_READ_FULLY) { |
|
|
|
ByteBuffer rawbuf = IO.readWholeStream(is, (int) len); |
|
|
|
ByteBuffer rawbuf = IO.readWholeStream(is, (int) len); |
|
|
|
byte[] raw = rawbuf.array(); |
|
|
|
byte[] raw = rawbuf.array(); |
|
|
@ -349,25 +349,22 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator { |
|
|
|
raw = rawbuf.array(); |
|
|
|
raw = rawbuf.array(); |
|
|
|
n = rawbuf.limit(); |
|
|
|
n = rawbuf.limit(); |
|
|
|
} |
|
|
|
} |
|
|
|
filteredIs = new ByteArrayInputStream(raw, 0, n); |
|
|
|
|
|
|
|
canonLen = n; |
|
|
|
canonLen = n; |
|
|
|
} else { |
|
|
|
return new ByteArrayInputStream(raw, 0, n); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (isBinary(e)) { |
|
|
|
if (isBinary(e)) { |
|
|
|
filteredIs = is; |
|
|
|
|
|
|
|
canonLen = len; |
|
|
|
canonLen = len; |
|
|
|
} else { |
|
|
|
return is; |
|
|
|
final InputStream lenIs = filterClean(e |
|
|
|
} |
|
|
|
.openInputStream()); |
|
|
|
|
|
|
|
|
|
|
|
final InputStream lenIs = filterClean(e.openInputStream()); |
|
|
|
try { |
|
|
|
try { |
|
|
|
canonLen = computeLength(lenIs); |
|
|
|
canonLen = computeLength(lenIs); |
|
|
|
} finally { |
|
|
|
} finally { |
|
|
|
safeClose(lenIs); |
|
|
|
safeClose(lenIs); |
|
|
|
} |
|
|
|
} |
|
|
|
filteredIs = filterClean(is); |
|
|
|
return filterClean(is); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return filteredIs; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static void safeClose(final InputStream in) { |
|
|
|
private static void safeClose(final InputStream in) { |
|
|
|