From ac58a70e3239a2ed637b869107e04e007bdbce58 Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Mon, 15 Jul 2013 23:26:42 -0700 Subject: [PATCH] Do not eagerly check for existence in FilePayload This is a TOCTOU violation and FilePayload.getInput already propagates this. This commit allows external callers like jclouds-cli to introspect on the exception type, returning a more friendly error message in some situations. --- core/src/main/java/org/jclouds/io/payloads/FilePayload.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/org/jclouds/io/payloads/FilePayload.java b/core/src/main/java/org/jclouds/io/payloads/FilePayload.java index 330c0c0e3e..b60616a1d4 100644 --- a/core/src/main/java/org/jclouds/io/payloads/FilePayload.java +++ b/core/src/main/java/org/jclouds/io/payloads/FilePayload.java @@ -34,7 +34,7 @@ public class FilePayload extends BasePayload { public FilePayload(File content) { super(content); getContentMetadata().setContentLength(content.length()); - checkArgument(checkNotNull(content, "content").exists(), "file must exist: " + content); + checkNotNull(content, "content"); } /**