diff options
author | Mili Verma <mili.verma@isode.com> | 2012-02-23 17:38:30 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2012-02-23 17:39:04 (GMT) |
commit | 9adba9899fcf98db402e279970056f7a2ada7915 (patch) | |
tree | eaf83641bb78b23c0c16331944afbd000c0d2949 | |
parent | c80110013f16d8aa4e6e9801e01ce9ccab1e6592 (diff) | |
download | stroke-9adba9899fcf98db402e279970056f7a2ada7915.zip stroke-9adba9899fcf98db402e279970056f7a2ada7915.tar.bz2 |
Fix Stroke to allow empty values
This patch gives a fix to a client of Stroke can send emtpty values in form
fields.
Test-information:
Tests pass.
Before patch, MLC is not able to send empty values in updates. After the patch,
it is.
-rw-r--r-- | src/com/isode/stroke/serializer/payloadserializers/FormSerializer.java | 4 | ||||
-rw-r--r-- | test/com/isode/stroke/serializer/payloadserializers/FormSerializerTest.java | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/com/isode/stroke/serializer/payloadserializers/FormSerializer.java b/src/com/isode/stroke/serializer/payloadserializers/FormSerializer.java index c2a2189..9ab5e37 100644 --- a/src/com/isode/stroke/serializer/payloadserializers/FormSerializer.java +++ b/src/com/isode/stroke/serializer/payloadserializers/FormSerializer.java @@ -191,12 +191,12 @@ public class FormSerializer extends GenericPayloadSerializer<Form> { private static void serializeValueAsString(GenericFormField<String> field, XMLElement parent) { String value = field.getValue(); - if (!value.isEmpty()) { + // FIXME with the proper fix after Swiften is fixed: if (!value.isEmpty()) { XMLElement valueElement = new XMLElement( FormField.FORM_FIELD_ELEMENT_VALUE); valueElement.addNode(XMLTextNode.create(value)); parent.addNode(valueElement); - } + // } } @Override diff --git a/test/com/isode/stroke/serializer/payloadserializers/FormSerializerTest.java b/test/com/isode/stroke/serializer/payloadserializers/FormSerializerTest.java index 4a1ccc0..7636eb4 100644 --- a/test/com/isode/stroke/serializer/payloadserializers/FormSerializerTest.java +++ b/test/com/isode/stroke/serializer/payloadserializers/FormSerializerTest.java @@ -125,13 +125,13 @@ public class FormSerializerTest { + "<value>jabber:bot</value>" + "</field>" + "<field type=\"fixed\"><value>Section 1: Bot Info</value></field>" - + "<field label=\"The name of your bot\" type=\"text-single\" var=\"botname\"/>" + + "<field label=\"The name of your bot\" type=\"text-single\" var=\"botname\"><value></value></field>" + "<field label=\"Helpful description of your bot\" type=\"text-multi\" var=\"description\"><value>This is a bot.</value><value>A quite good one actually</value></field>" + "<field label=\"Public bot?\" type=\"boolean\" var=\"public\">" + "<required/>" + "<value>1</value>" + "</field>" - + "<field label=\"Password for special access\" type=\"text-private\" var=\"password\"/>" + + "<field label=\"Password for special access\" type=\"text-private\" var=\"password\"><value></value></field>" + "<field label=\"What features will the bot support?\" type=\"list-multi\" var=\"features\">" + "<value>news</value>" + "<value>search</value>" |