Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 956f2ac9 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Fix handling of null "standalone" value.

As part of transitioning the OS towards FastXmlSerializer, we found
at least one example of a caller who is omitting a "standalone" value
by passing null.  Handle this by mirroring the behavior of the
upstream KXmlSerializer and omitting the attribute entirely when
the value is undefined.

Bug: 174561276
Test: manual
Change-Id: I868aceaed8e3dd1575947a56b28f8fff8759c0ae
parent a01f7505
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -367,8 +367,11 @@ public class FastXmlSerializer implements XmlSerializer {

    public void startDocument(String encoding, Boolean standalone) throws IOException,
            IllegalArgumentException, IllegalStateException {
        append("<?xml version='1.0' encoding='utf-8' standalone='"
                + (standalone ? "yes" : "no") + "' ?>\n");
        append("<?xml version='1.0' encoding='utf-8'");
        if (standalone != null) {
            append(" standalone='" + (standalone ? "yes" : "no") + "'");
        }
        append(" ?>\n");
        mLineStart = true;
    }