@@ -92,7 +92,7 @@ public Executor(List<String> cmdList) {
9292 * @param cmdList A list containing the command to execute
9393 * @param workingDirectory The directory the process should have as the working directory
9494 */
95- public Executor (List <String > cmdList , File workingDirectory ) {
95+ public Executor (List <String > cmdList , @ Nullable File workingDirectory ) {
9696 this (cmdList , workingDirectory , new HashMap <>());
9797 }
9898
@@ -104,7 +104,7 @@ public Executor(List<String> cmdList, File workingDirectory) {
104104 * it will be terminated. If the value is 0, no timer
105105 * will be set up.
106106 */
107- public Executor (List <String > cmdList , File workingDirectory , int timeout ) {
107+ public Executor (List <String > cmdList , @ Nullable File workingDirectory , int timeout ) {
108108 this (cmdList , workingDirectory , new HashMap <>());
109109
110110 this .timeout = timeout * 1000 ;
@@ -116,7 +116,7 @@ public Executor(List<String> cmdList, File workingDirectory, int timeout) {
116116 * @param cmdList A list containing the command to execute
117117 * @param workingDirectory The directory the process should have as the working directory
118118 */
119- public Executor (List <String > cmdList , File workingDirectory , Map <String , String > environ ) {
119+ public Executor (List <String > cmdList , @ Nullable File workingDirectory , Map <String , String > environ ) {
120120 this .cmdList = cmdList ;
121121 this .workingDirectory = workingDirectory ;
122122 this .environ = environ ;
@@ -144,6 +144,10 @@ private void setDefaultTimeout() {
144144 this .timeout = timeoutSec * 1000 ;
145145 }
146146
147+ int getTimeout () {
148+ return timeout / 1000 ;
149+ }
150+
147151 /**
148152 * Execute the command and collect the output. All exceptions will be
149153 * logged.
@@ -239,7 +243,7 @@ public int exec(final boolean reportExceptions, StreamHandler handler) {
239243 @ Override public void run () {
240244 LOGGER .log (Level .WARNING ,
241245 String .format ("Terminating process of command [%s] in directory '%s' " +
242- "due to timeout %d seconds" , cmd_str , dir_str , timeout / 1000 ));
246+ "due to timeout %d seconds" , cmd_str , dir_str , getTimeout () ));
243247 proc .destroy ();
244248 }
245249 }, timeout );
0 commit comments