Skip to content
Permalink
Browse files
[JENKINS-32286] fix
  • Loading branch information
boaglio committed Jan 16, 2016
1 parent 69b9417 commit 27bea86f5fd4075477da45397ac070f15bd41e05
Showing with 21 additions and 7 deletions.
  1. +21 −7 src/main/java/org/jenkinsci/plugins/sqlplusscriptrunner/SQLPlusRunner.java
@@ -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)); }
}

@@ -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 {
@@ -289,8 +305,6 @@ private String createTempScript(String content) {
} catch (IOException e) {}

}
return tempFile;

}

private boolean isWindowsOS() {

0 comments on commit 27bea86

Please sign in to comment.