From 1a003ee731a30c1d2546027dbe58941f5f6093c2 Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Tue, 20 Aug 2013 16:50:02 -0700 Subject: [PATCH] Handle large putBlob with filesystem blobstore Previously large putBlob caused an OutOfMemoryError even with repeatable Payloads. Fixes JCLOUDS-248. --- .../strategy/internal/FilesystemStorageStrategyImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apis/filesystem/src/main/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImpl.java b/apis/filesystem/src/main/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImpl.java index f5b2ce295c..0206f018e3 100644 --- a/apis/filesystem/src/main/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImpl.java +++ b/apis/filesystem/src/main/java/org/jclouds/filesystem/strategy/internal/FilesystemStorageStrategyImpl.java @@ -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);