diff options
Diffstat (limited to 'src/com/isode/stroke/serializer/payloadserializers/CommandSerializer.java')
-rw-r--r-- | src/com/isode/stroke/serializer/payloadserializers/CommandSerializer.java | 8 |
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(); } |