@@ -55,7 +55,7 @@ public ProcessHandler(String[] cmd, File workingDir) {
55
55
}
56
56
57
57
/**
58
- * Set the log that standard out of process will be written to .
58
+ * Set the file to which standard out of the process should be written.
59
59
*
60
60
* @param log the stdout log file
61
61
*/
@@ -206,8 +206,7 @@ public void exec(List<String> linesToPipeToStdin) throws ScriptRunnerException {
206
206
LOGGER .entering (CLASS , METHOD );
207
207
208
208
if (waitHandler == null ) {
209
- ScriptRunnerException sre =
210
- new ScriptRunnerException ("WLSDPLY-01201" , this .toString ());
209
+ ScriptRunnerException sre = new ScriptRunnerException ("WLSDPLY-01201" , this .toString ());
211
210
LOGGER .throwing (CLASS , METHOD , sre );
212
211
throw sre ;
213
212
}
@@ -220,21 +219,22 @@ public void exec(List<String> linesToPipeToStdin) throws ScriptRunnerException {
220
219
process = procBuilder .start ();
221
220
} catch (IOException ioe ) {
222
221
ScriptRunnerException sre =
223
- new ScriptRunnerException ("WLSDPLY-01203" , ioe , this .toString (), ioe .getLocalizedMessage ());
222
+ new ScriptRunnerException ("WLSDPLY-01203" , ioe , this .toString (), ioe .getLocalizedMessage ());
224
223
LOGGER .throwing (CLASS , METHOD , sre );
225
224
throw sre ;
226
225
}
227
226
228
227
if (linesToPipeToStdin != null && !linesToPipeToStdin .isEmpty ()) {
229
228
try (BufferedWriter writer =
230
- new BufferedWriter (new OutputStreamWriter (process .getOutputStream (), DEFAULT_CHARSET ))) {
229
+ new BufferedWriter (new OutputStreamWriter (process .getOutputStream (), DEFAULT_CHARSET ))) {
230
+
231
231
for (String line : linesToPipeToStdin ) {
232
232
writer .write (line );
233
233
writer .newLine ();
234
234
}
235
235
} catch (IOException ioe ) {
236
236
ScriptRunnerException sre =
237
- new ScriptRunnerException ("WLSDPLY-01204" , ioe , this .toString (), ioe .getLocalizedMessage ());
237
+ new ScriptRunnerException ("WLSDPLY-01204" , ioe , this .toString (), ioe .getLocalizedMessage ());
238
238
LOGGER .throwing (CLASS , METHOD , sre );
239
239
throw sre ;
240
240
}
@@ -257,7 +257,7 @@ public void exec(List<String> linesToPipeToStdin) throws ScriptRunnerException {
257
257
process .destroy ();
258
258
}
259
259
ScriptRunnerException sre =
260
- new ScriptRunnerException ("WLSDPLY-01205" , this .toString (), elapsed , timeout );
260
+ new ScriptRunnerException ("WLSDPLY-01205" , this .toString (), elapsed , timeout );
261
261
LOGGER .throwing (CLASS , METHOD , sre );
262
262
throw sre ;
263
263
}
@@ -305,7 +305,8 @@ public String toString() {
305
305
public void run () {
306
306
PrintStream logWriter = null ;
307
307
try (BufferedReader reader =
308
- new BufferedReader (new InputStreamReader (process .getInputStream (), DEFAULT_CHARSET ))) {
308
+ new BufferedReader (new InputStreamReader (process .getInputStream (), DEFAULT_CHARSET ))) {
309
+
309
310
if (logFile != null ) {
310
311
FileOutputStream fos = new FileOutputStream (logFile , appendFlag );
311
312
logWriter = new PrintStream (fos , true , StandardCharsets .UTF_8 .toString ());
0 commit comments