Fixed: streaming large content cause out of memory exception.
(OFBIZ-10133) No functional change in trunk Slightly improves formatting in streamContent() in trunk. Uses the same code in R16, notably for setting byte[] buffer = new byte[bufferSize]; that guarantee no issues, and using try-with-ressource git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1821054 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -1092,10 +1092,8 @@ public final class UtilHttp {
|
||||
int bufferSize = EntityUtilProperties.getPropertyAsInteger("content", "stream.buffersize", 8192);
|
||||
byte[] buffer = new byte[bufferSize];
|
||||
int read = 0;
|
||||
try (
|
||||
BufferedOutputStream bos = new BufferedOutputStream(out, bufferSize);
|
||||
BufferedInputStream bis = new BufferedInputStream(in, bufferSize);
|
||||
) {
|
||||
try (BufferedOutputStream bos = new BufferedOutputStream(out, bufferSize);
|
||||
BufferedInputStream bis = new BufferedInputStream(in, bufferSize)) {
|
||||
while ((read = bis.read(buffer, 0, buffer.length)) != -1) {
|
||||
bos.write(buffer, 0, read);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user