Skip to content

Commit

Permalink
Fix various bugs with SetArgs and GetArgs commands (manifests as vari…
Browse files Browse the repository at this point in the history
…ous IOException errors in log files)

git-svn-id: https://sagetv-addons.googlecode.com/svn/trunk/sjq4@1401 4d529e3f-d655-0410-97be-dbb2a4780eb3
  • Loading branch information
[email protected] committed Feb 26, 2011
1 parent 524702f commit fbbf059
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
12 changes: 10 additions & 2 deletions src/com/google/code/sagetvaddons/sjq/server/commands/Getargs.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
* <p>Provides the ability to dynamic exe args as set by the task's test script
* <p><pre>
* R: long (task id)
* W: String[] (args, null if no override set)
* W: boolean (true if override exists or false if none is defined)
* W: String (args, read but ignored if boolean above = false)
* </pre></p>
* @author dbattams
* @version $Id$
Expand All @@ -49,7 +50,14 @@ public Getargs(ObjectInputStream in, ObjectOutputStream out) {
@Override
public void execute() throws IOException {
long taskId = getIn().readLong();
getOut().writeUTF(TaskQueue.get().getExeArgs(taskId));
String args = TaskQueue.get().getExeArgs(taskId);
boolean hasArgs = true;
if(args == null) {
args = "";
hasArgs = false;
}
getOut().writeBoolean(hasArgs);
getOut().writeUTF(args);
getOut().writeObject(NetworkAck.get(NetworkAck.OK));
getOut().flush();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
* <p>Provides the ability to dynamically set the args for an exe from its test script
* <p><pre>
* R: long (task id)
* R: String[] (args)
* R: bool (isNotNull)
* R: String (args)
* W: ACK
* </pre></p>
* @author dbattams
Expand All @@ -50,8 +51,9 @@ public Setargs(ObjectInputStream in, ObjectOutputStream out) {
@Override
public void execute() throws IOException {
long taskId = getIn().readLong();
boolean isOverride = getIn().readBoolean();
String args = (String)getIn().readUTF();
boolean result = TaskQueue.get().setExeArgs(taskId, args);
boolean result = TaskQueue.get().setExeArgs(taskId, isOverride ? args : null);
getOut().writeObject(NetworkAck.get(result ? NetworkAck.OK : NetworkAck.ERR));
getOut().flush();
}
Expand Down

0 comments on commit fbbf059

Please sign in to comment.