diff --git a/client/src/main/java/ctbrec/ui/event/PlaySound.java b/client/src/main/java/ctbrec/ui/event/PlaySound.java index c23d77cd..aded0087 100644 --- a/client/src/main/java/ctbrec/ui/event/PlaySound.java +++ b/client/src/main/java/ctbrec/ui/event/PlaySound.java @@ -12,11 +12,13 @@ public class PlaySound extends Action { private URL url; - public PlaySound() {} + public PlaySound() { + name = "play sound"; + } public PlaySound(URL url) { + this(); this.url = url; - name = "play sound"; } @Override diff --git a/common/src/main/java/ctbrec/event/ExecuteProgram.java b/common/src/main/java/ctbrec/event/ExecuteProgram.java index 27c08ca1..28cb4807 100644 --- a/common/src/main/java/ctbrec/event/ExecuteProgram.java +++ b/common/src/main/java/ctbrec/event/ExecuteProgram.java @@ -1,5 +1,7 @@ package ctbrec.event; +import java.util.Arrays; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -13,11 +15,13 @@ public class ExecuteProgram extends Action { private String executable; - public ExecuteProgram() {} + public ExecuteProgram() { + name = "execute program"; + } public ExecuteProgram(String executable) { + this(); this.executable = executable; - name = "execute program"; } @Override @@ -25,8 +29,12 @@ public class ExecuteProgram extends Action { Runtime rt = Runtime.getRuntime(); Process process = null; try { - String[] args = {executable}; // TODO fill args array - process = rt.exec(args, OS.getEnvironment()); + String[] args = evt.getExecutionParams(); + String[] cmd = new String[args.length+1]; + cmd[0] = executable; + System.arraycopy(args, 0, cmd, 1, args.length); + LOG.debug("Executing {}", Arrays.toString(cmd)); + process = rt.exec(cmd, OS.getEnvironment()); // create threads, which read stdout and stderr of the player process. these are needed, // because otherwise the internal buffer for these streams fill up and block the process @@ -40,7 +48,7 @@ public class ExecuteProgram extends Action { err.start(); process.waitFor(); - LOG.debug("{} finished", name); + LOG.debug("executing {} finished", executable); } catch (Exception e) { LOG.error("Error while processing {}", e); } @@ -50,4 +58,9 @@ public class ExecuteProgram extends Action { public void configure(ActionConfiguration config) { executable = (String) config.getConfiguration().get("file"); } + + @Override + public String toString() { + return "execute " + executable; + } }