mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-12-22 02:27:58 +01:00
Fix NPE in BoBIQ by adding XmlStringBuilder.optIntAttribute(String, Integer)
The method was missing and hence BoBIQ used optIntAttribute(String, int) instead, which resulted in an NPE if the Integer was null. Fixes SMACK-895.
This commit is contained in:
parent
ca3679add9
commit
fcc372754e
1 changed files with 16 additions and 0 deletions
|
@ -390,6 +390,22 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the provided Integer argument is not null, then add a new XML attribute with the given name and the Integer as
|
||||||
|
* value.
|
||||||
|
*
|
||||||
|
* @param name the XML attribute name.
|
||||||
|
* @param value the optional integer to use as the attribute's value.
|
||||||
|
* @return a reference to this object.
|
||||||
|
* @since 4.4.1
|
||||||
|
*/
|
||||||
|
public XmlStringBuilder optIntAttribute(String name, Integer value) {
|
||||||
|
if (value != null) {
|
||||||
|
attribute(name, value.toString());
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the given attribute if value not null and {@code value => 0}.
|
* Add the given attribute if value not null and {@code value => 0}.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue