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 41eb07e2e3..b8836157c4 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 @@ -208,8 +208,10 @@ public class FilesystemStorageStrategyImpl implements FilesystemStorageStrategy Files.createParentDirs(outputFile); if (payload.getRawContent() instanceof File) Files.copy(File.class.cast(payload.getRawContent()), outputFile); - else - payload.writeTo(new FileOutputStream(outputFile)); + else { + output = new FileOutputStream(outputFile); + payload.writeTo(output); + } } catch (IOException ex) { if (outputFile != null) { outputFile.delete();