1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-12-22 20:47:57 +01:00

XmlStringBuilder: Use potential length for target StringBuilder

This commit is contained in:
Florian Schmaus 2019-09-18 08:55:51 +02:00
parent fb3a71a14d
commit 8086a11c6c

View file

@ -628,7 +628,9 @@ public class XmlStringBuilder implements Appendable, CharSequence, Element {
@Override
public CharSequence toXML(XmlEnvironment enclosingXmlEnvironment) {
StringBuilder res = new StringBuilder();
// This is only the potential length, since the actual length depends on the given XmlEnvironment.
int potentialLength = length();
StringBuilder res = new StringBuilder(potentialLength);
try {
appendXmlTo(res, enclosingXmlEnvironment);
} catch (IOException e) {