소스 검색

fix issue in IOUtils.toByteArrayWithMaxLength

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1898861 13f79535-47bb-0310-9956-ffa450edef68
tags/REL_5_2_2
PJ Fanning 2 년 전
부모
커밋
f4bfcaeec9

+ 1
- 3
poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFChart.java 파일 보기

@@ -92,13 +92,11 @@ public class XWPFChart extends XDDFChart {

public Long getChecksum() {
if (this.checksum == null) {
byte[] data;
try (InputStream is = getPackagePart().getInputStream()) {
data = IOUtils.toByteArrayWithMaxLength(is, XWPFPictureData.getMaxImageSize());
this.checksum = IOUtils.calculateChecksum(is);
} catch (IOException e) {
throw new POIXMLException(e);
}
this.checksum = IOUtils.calculateChecksum(data);
}
return this.checksum;
}

+ 1
- 3
poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFPictureData.java 파일 보기

@@ -163,13 +163,11 @@ public class XWPFPictureData extends POIXMLDocumentPart {

public Long getChecksum() {
if (this.checksum == null) {
byte[] data;
try (InputStream is = getPackagePart().getInputStream()) {
data = IOUtils.toByteArrayWithMaxLength(is, getMaxImageSize());
this.checksum = IOUtils.calculateChecksum(is);
} catch (IOException e) {
throw new POIXMLException(e);
}
this.checksum = IOUtils.calculateChecksum(data);
}
return this.checksum;
}

+ 1
- 1
poi/src/main/java/org/apache/poi/util/IOUtils.java 파일 보기

@@ -202,7 +202,7 @@ public final class IOUtils {
}

final int derivedLen = Math.min(length, derivedMaxLength);
final int bufferLen = isLengthKnown ? derivedLen : 4096;
final int bufferLen = isLengthKnown ? derivedLen : Math.min(4096, derivedLen);
try (UnsynchronizedByteArrayOutputStream baos = new UnsynchronizedByteArrayOutputStream(bufferLen)) {
byte[] buffer = new byte[4096];
int totalBytes = 0, readBytes;

Loading…
취소
저장