From 7cbfd427365701b484f9c1f2f3e47d88bc275e4e Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Mon, 7 May 2012 13:23:09 -0700 Subject: [PATCH] Do not check for equality on overwrites Firstly, this check never triggered because Payload.equals always returns false for File objects. Secondly, this would not reduce IO even if it worked since the common case is not overwriting a file with the same contents. Lastly, simplify a cast. --- .../strategy/internal/FilesystemStorageStrategyImpl.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) 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 bffac5a35c..2818cdfa97 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,15 +199,11 @@ public class FilesystemStorageStrategyImpl implements FilesystemStorageStrategy filesystemContainerNameValidator.validate(container); filesystemBlobKeyValidator.validate(blobKey); File outputFile = getFileForBlobKey(container, blobKey); - if (payload.getRawContent().equals(outputFile)){ - // we shouldn't re-copy the same contents - return; - } FileOutputStream output = null; try { Files.createParentDirs(outputFile); if (payload.getRawContent() instanceof File) - Files.copy(File.class.cast(payload.getRawContent()), outputFile); + Files.copy((File) payload.getRawContent(), outputFile); else { output = new FileOutputStream(outputFile); payload.writeTo(output);