Repository: oozie
Updated Branches:
  refs/heads/master 11d588b7e -> 4cec1ad34


OOZIE-2727 OozieDBCLI creates temporary directories and do not delete them 
(gezapeti via rkanter)


Project: http://git-wip-us.apache.org/repos/asf/oozie/repo
Commit: http://git-wip-us.apache.org/repos/asf/oozie/commit/4cec1ad3
Tree: http://git-wip-us.apache.org/repos/asf/oozie/tree/4cec1ad3
Diff: http://git-wip-us.apache.org/repos/asf/oozie/diff/4cec1ad3

Branch: refs/heads/master
Commit: 4cec1ad34b03b795aef8285dbb87276af7b5fc91
Parents: 11d588b
Author: Robert Kanter <[email protected]>
Authored: Fri Jan 6 13:13:22 2017 -0800
Committer: Robert Kanter <[email protected]>
Committed: Fri Jan 6 13:13:22 2017 -0800

----------------------------------------------------------------------
 release-log.txt                                            | 1 +
 tools/src/main/java/org/apache/oozie/tools/OozieDBCLI.java | 9 ++++++---
 2 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/oozie/blob/4cec1ad3/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index 012a41d..577e071 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -1,5 +1,6 @@
 -- Oozie 4.4.0 release (trunk - unreleased)
 
+OOZIE-2727 OozieDBCLI creates temporary directories and do not delete them 
(gezapeti via rkanter)
 OOZIE-2728 Typo in Error E0405 (gezapeti via rkanter)
 OOZIE-2748 NPE in LauncherMapper.printArgs() (pbacsko via rkanter)
 OOZIE-2754 Document Ssh action failure if output is written to stdout/stderr 
upon login (asasvari via rkanter)

http://git-wip-us.apache.org/repos/asf/oozie/blob/4cec1ad3/tools/src/main/java/org/apache/oozie/tools/OozieDBCLI.java
----------------------------------------------------------------------
diff --git a/tools/src/main/java/org/apache/oozie/tools/OozieDBCLI.java 
b/tools/src/main/java/org/apache/oozie/tools/OozieDBCLI.java
index 8ada2e4..ce19e80 100644
--- a/tools/src/main/java/org/apache/oozie/tools/OozieDBCLI.java
+++ b/tools/src/main/java/org/apache/oozie/tools/OozieDBCLI.java
@@ -119,9 +119,12 @@ public class OozieDBCLI {
                     throw new Exception("'-sqlfile <FILE>' or '-run' options 
must be specified");
                 }
                 CommandLine commandLine = command.getCommandLine();
-                String sqlFile = (commandLine.hasOption(SQL_FILE_OPT))
-                                 ? commandLine.getOptionValue(SQL_FILE_OPT)
-                                 : File.createTempFile("ooziedb-", 
".sql").getAbsolutePath();
+                String sqlFile =  commandLine.getOptionValue(SQL_FILE_OPT);
+                if(sqlFile == null || sqlFile.isEmpty()) {
+                    File tempFile = File.createTempFile("ooziedb-", ".sql");
+                    tempFile.deleteOnExit();
+                    sqlFile = tempFile.getAbsolutePath();
+                }
                 boolean run = commandLine.hasOption(RUN_OPT);
                 if (command.getName().equals(CREATE_CMD)) {
                     createDB(sqlFile, run);

Reply via email to