summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMili Verma <mili.verma@isode.com>2012-01-10 15:55:29 (GMT)
committerKevin Smith <git@kismith.co.uk>2012-01-11 13:44:37 (GMT)
commitbe94e872d9423501c688c84c6cb945a420a5cb18 (patch)
tree77986e9e30282b526c0246bb6344c175b54ffb5f /src/com/isode/stroke/serializer/payloadserializers/CommandSerializer.java
parentc9ff80a46b13b7d1987bf54cae87738a9baf552b (diff)
downloadstroke-be94e872d9423501c688c84c6cb945a420a5cb18.zip
stroke-be94e872d9423501c688c84c6cb945a420a5cb18.tar.bz2
Update review comment related stuff
This patch addresses some review comments: 1. Updates the Javadoc. 2. Disallows arguments from being null - throws NullPointerException. 3. Updates each test to use its own DummyEventLoop. Test-information: Unit tests pass.
Diffstat (limited to 'src/com/isode/stroke/serializer/payloadserializers/CommandSerializer.java')
-rw-r--r--src/com/isode/stroke/serializer/payloadserializers/CommandSerializer.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/com/isode/stroke/serializer/payloadserializers/CommandSerializer.java b/src/com/isode/stroke/serializer/payloadserializers/CommandSerializer.java
index 411e711..d4ec836 100644
--- a/src/com/isode/stroke/serializer/payloadserializers/CommandSerializer.java
+++ b/src/com/isode/stroke/serializer/payloadserializers/CommandSerializer.java
@@ -30,6 +30,10 @@ public class CommandSerializer extends GenericPayloadSerializer<Command> {
}
public String serializePayload(Command command) {
+ if (command == null) {
+ throw new NullPointerException("'command' must not be null");
+ }
+
XMLElement commandElement = new XMLElement("command",
"http://jabber.org/protocol/commands");
commandElement.setAttribute(Command.COMMAND_ATTRIBUTE_NODE, command
@@ -86,6 +90,10 @@ public class CommandSerializer extends GenericPayloadSerializer<Command> {
}
private String actionToString(Action action) {
+ if (action == null) {
+ throw new NullPointerException("'action' must not be null");
+ }
+
return action.getStringForm();
}