summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorSimon Rettberg2016-12-01 15:16:35 +0100
committerSimon Rettberg2016-12-01 15:16:35 +0100
commita9c0ef8b10b87765e545cd03bca67eddfc456b0a (patch)
treec66aae82ea7364eec3db39a90012c5290e4fe915 /api
parentAdd cancellable tasks, optional response payload compression (diff)
downloadtaskman-lite-a9c0ef8b10b87765e545cd03bca67eddfc456b0a.tar.gz
taskman-lite-a9c0ef8b10b87765e545cd03bca67eddfc456b0a.tar.xz
taskman-lite-a9c0ef8b10b87765e545cd03bca67eddfc456b0a.zip
Better error logging: Include exception in some logger calls
Diffstat (limited to 'api')
-rw-r--r--api/src/main/java/org/openslx/taskmanager/api/SystemCommandTask.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/api/src/main/java/org/openslx/taskmanager/api/SystemCommandTask.java b/api/src/main/java/org/openslx/taskmanager/api/SystemCommandTask.java
index 7b67c12..2f3cf57 100644
--- a/api/src/main/java/org/openslx/taskmanager/api/SystemCommandTask.java
+++ b/api/src/main/java/org/openslx/taskmanager/api/SystemCommandTask.java
@@ -5,6 +5,7 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
import org.apache.log4j.Logger;
@@ -37,6 +38,12 @@ public abstract class SystemCommandTask extends AbstractTask
if ( command == null || command.length == 0 ) {
return processEnded( -1 );
}
+ for (String a : command) {
+ if (a == null) {
+ log.warn( "An argument from initCommandLine is null: " + Arrays.toString( command ) );
+ return processEnded( -5 );
+ }
+ }
ProcessBuilder pb = new ProcessBuilder( command );
pb.directory( new File( "/" ) );
@@ -47,7 +54,7 @@ public abstract class SystemCommandTask extends AbstractTask
try {
process = pb.start();
} catch ( Exception e ) {
- log.warn( "Process of task " + getId() + " died." );
+ log.warn( "Process of task " + getId() + " died.", e );
processStdErrInternal( e.toString() );
return processEnded( -2 );
}