You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2014/08/05 07:24:46 UTC

[02/10] git commit: writeToTempFile should follow the semantics of newTempFile

writeToTempFile should follow the semantics of newTempFile

Os.*TempFile methods would be expected to behave in a similar manner.
Use newTempFile which will normalize prefix/suffix arguments.


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/6b393041
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/6b393041
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/6b393041

Branch: refs/heads/master
Commit: 6b3930415accb53e08345e323da1f2330defdcf4
Parents: e315de3
Author: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Authored: Wed Jul 23 18:21:20 2014 +0300
Committer: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Committed: Wed Jul 23 18:21:20 2014 +0300

----------------------------------------------------------------------
 utils/common/src/main/java/brooklyn/util/os/Os.java | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/6b393041/utils/common/src/main/java/brooklyn/util/os/Os.java
----------------------------------------------------------------------
diff --git a/utils/common/src/main/java/brooklyn/util/os/Os.java b/utils/common/src/main/java/brooklyn/util/os/Os.java
index 0602fdc..868fe31 100644
--- a/utils/common/src/main/java/brooklyn/util/os/Os.java
+++ b/utils/common/src/main/java/brooklyn/util/os/Os.java
@@ -407,14 +407,7 @@ public class Os {
     public static File writeToTempFile(InputStream is, File tempDir, String prefix, String suffix) {
         Preconditions.checkNotNull(is, "Input stream required to create temp file for %s*%s", prefix, suffix);
         mkdirs(tempDir);
-        File tempFile;
-        try {
-            tempFile = File.createTempFile(prefix, suffix, tempDir);
-        } catch (IOException e) {
-            throw Throwables.propagate(new IOException("Unable to create temp file in "+tempDir+" of form "+prefix+"-"+suffix, e));
-        }
-        tempFile.deleteOnExit();
-
+        File tempFile = newTempFile(prefix, suffix);
         OutputStream out = null;
         try {
             out = new FileOutputStream(tempFile);