Handle large putBlob with filesystem blobstore

Previously large putBlob caused an OutOfMemoryError even with
repeatable Payloads.  Fixes JCLOUDS-248.
This commit is contained in:
Andrew Gaul 2013-08-20 16:50:02 -07:00 committed by Andrew Phillips
parent d60d2681d1
commit 1a003ee731
1 changed files with 3 additions and 1 deletions

View File

@ -199,7 +199,9 @@ public class FilesystemStorageStrategyImpl implements LocalStorageStrategy {
if (payload.getRawContent() instanceof File)
Files.copy((File) payload.getRawContent(), outputFile);
else {
payload = Payloads.newPayload(ByteStreams.toByteArray(payload));
if (!payload.isRepeatable()) {
payload = Payloads.newPayload(ByteStreams.toByteArray(payload));
}
Files.copy(payload, outputFile);
}
Payloads.calculateMD5(payload);