mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-25 15:52:06 +01:00
Fix XEP-0080 geoloc extensions elements formating
XEP-0080 states that lon,lat,error,alt,accuracy,bearing and speed are decimal values, and thus should either be present as decimal, or not present at all (as they are optional elements). Usage of String.valueOf(value) in code lead to creating a "null" string in case number was not present, thus creating an element with "null" content, which is not a valid decimal value.
This commit is contained in:
parent
5272680d47
commit
cf2027fce7
1 changed files with 7 additions and 7 deletions
|
@ -211,24 +211,24 @@ public class GeoLocation implements Serializable, ExtensionElement {
|
||||||
public CharSequence toXML() {
|
public CharSequence toXML() {
|
||||||
XmlStringBuilder xml = new XmlStringBuilder(this);
|
XmlStringBuilder xml = new XmlStringBuilder(this);
|
||||||
xml.rightAngleBracket();
|
xml.rightAngleBracket();
|
||||||
xml.optElement("accuracy", String.valueOf(accuracy));
|
xml.optElement("accuracy", accuracy);
|
||||||
xml.optElement("alt", String.valueOf(alt));
|
xml.optElement("alt", alt);
|
||||||
xml.optElement("area", area);
|
xml.optElement("area", area);
|
||||||
xml.optElement("bearing", String.valueOf(bearing));
|
xml.optElement("bearing", bearing);
|
||||||
xml.optElement("building", building);
|
xml.optElement("building", building);
|
||||||
xml.optElement("country", country);
|
xml.optElement("country", country);
|
||||||
xml.optElement("countrycode", countryCode);
|
xml.optElement("countrycode", countryCode);
|
||||||
xml.optElement("datum", datum);
|
xml.optElement("datum", datum);
|
||||||
xml.optElement("description", description);
|
xml.optElement("description", description);
|
||||||
xml.optElement("error", String.valueOf(error));
|
xml.optElement("error", error);
|
||||||
xml.optElement("floor", floor);
|
xml.optElement("floor", floor);
|
||||||
xml.optElement("lat", String.valueOf(lat));
|
xml.optElement("lat", lat);
|
||||||
xml.optElement("locality", locality);
|
xml.optElement("locality", locality);
|
||||||
xml.optElement("lon", String.valueOf(lon));
|
xml.optElement("lon", lon);
|
||||||
xml.optElement("postalcode", postalcode);
|
xml.optElement("postalcode", postalcode);
|
||||||
xml.optElement("region", region);
|
xml.optElement("region", region);
|
||||||
xml.optElement("room", room);
|
xml.optElement("room", room);
|
||||||
xml.optElement("speed", String.valueOf(speed));
|
xml.optElement("speed", speed);
|
||||||
xml.optElement("street", street);
|
xml.optElement("street", street);
|
||||||
xml.optElement("text", text);
|
xml.optElement("text", text);
|
||||||
xml.optElement("timestamp", timestamp);
|
xml.optElement("timestamp", timestamp);
|
||||||
|
|
Loading…
Reference in a new issue