diff --git a/documentation/extensions/index.md b/documentation/extensions/index.md index 9e29b5bae..005eddb60 100644 --- a/documentation/extensions/index.md +++ b/documentation/extensions/index.md @@ -48,6 +48,7 @@ Smack Extensions and currently supported XEPs by Smack (smack-extensions) | Stream Initation | [XEP-0095](http://xmpp.org/extensions/xep-0095.html) | Initiating a data stream between any two XMPP entities. | | [SI File Transfer](filetransfer.html) | [XEP-0096](http://xmpp.org/extensions/xep-0096.html) | Transfer files between two users over XMPP. | | [Entity Capabilities](caps.html) | [XEP-0115](http://xmpp.org/extensions/xep-0115.html) | Broadcasting and dynamic discovery of entity capabilities. | +| Data Forms Validation | [XEP-0122](http://xmpp.org/extensions/xep-0122.html) | Enables an application to specify additional validation guidelines . | | Stream Compression | [XEP-0138](http://xmpp.org/extensions/xep-0138.html) | Support for optional compression of the XMPP stream. | Data Forms Layout | [XEP-0141](http://xmpp.org/extensions/xep-0141.html) | Enables an application to specify form layouts. | | Personal Eventing Protocol | [XEP-0163](http://xmpp.org/extensions/xep-0163.html) | Using the XMPP publish-subscribe protocol to broadcast state change events associated with a XMPP account. | diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java b/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java index 708beb1ca..55c07e07a 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java @@ -206,14 +206,14 @@ public class XmlStringBuilder implements Appendable, CharSequence { } /** - * Add the given attribute if value => 0 + * Add the given attribute if value not null and value => 0. * * @param name * @param value * @return a reference to this object */ public XmlStringBuilder optLongAttribute(String name, Long value) { - if (value >= 0) { + if (value != null && value >= 0) { attribute(name, Long.toString(value)); } return this; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/FormField.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/FormField.java index 6ba006cde..924a8a573 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/FormField.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/FormField.java @@ -17,12 +17,13 @@ package org.jivesoftware.smackx.xdata; -import org.jivesoftware.smack.util.XmlStringBuilder; - import java.util.ArrayList; import java.util.Collections; import java.util.List; +import org.jivesoftware.smack.util.XmlStringBuilder; +import org.jivesoftware.smackx.xdatavalidation.packet.ValidateElement; + /** * Represents a field of a form. The field could be used to represent a question to complete, * a completed question or a data returned from a search. The exact interpretation of the field @@ -124,6 +125,7 @@ public class FormField { private Type type; private final List