Skip to content

Commit

Permalink
[JENKINS-32286] fix
Browse files Browse the repository at this point in the history
  • Loading branch information
boaglio committed Jan 16, 2016
1 parent 69b9417 commit 27bea86
Showing 1 changed file with 21 additions and 7 deletions.
Expand Up @@ -164,6 +164,7 @@ public Void invoke(File path,VirtualChannel channel) throws IOException,Interrup
} else {
listener.getLogger().println(MSG_SCRIPT + " " + path + File.separator + script + " " + ON + " " + user + SLASH + HIDDEN_PASSWORD + AT + instanceStr);
File scriptFile = new File(path + File.separator + script);
addExit(null,scriptFile);
if (!scriptFile.exists()) { throw new RuntimeException(Messages.SQLPlusRunner_missingScript(path + File.separator + script)); }
}

Expand Down Expand Up @@ -270,17 +271,32 @@ private void runGetSQLPLusVersion(String oracleHome,BuildListener listener) {
private String createTempScript(String content) {

String tempFile = "";
BufferedWriter bw = null;
try {

File file = File.createTempFile(SQL_TEMP_SCRIPT + System.currentTimeMillis(),SQL_PREFIX);

FileWriter fw = new FileWriter(file.getAbsoluteFile());
bw = new BufferedWriter(fw);
bw.write(content);
bw.write(SQLPLUS_EXIT);
addExit(content,file);

tempFile = file.getPath();

} catch (IOException e) {
e.printStackTrace();
}
return tempFile;

}

private void addExit(String content,File file) throws IOException {

BufferedWriter bw = null;
try {

FileWriter fw = new FileWriter(file.getAbsoluteFile(),true);
bw = new BufferedWriter(fw);
if (content != null) {
bw.write(content);
}
bw.write(SQLPLUS_EXIT);
} catch (IOException e) {
e.printStackTrace();
} finally {
Expand All @@ -289,8 +305,6 @@ private String createTempScript(String content) {
} catch (IOException e) {}

}
return tempFile;

}

private boolean isWindowsOS() {
Expand Down

0 comments on commit 27bea86

Please sign in to comment.