Gracefully handle null values

This commit is contained in:
Connor Tumbleson 2015-12-14 07:00:46 -06:00
parent be4bdf1d75
commit 7e803aeac9
2 changed files with 5 additions and 8 deletions

View File

@ -26,16 +26,14 @@ public class ExtMXSerializer extends MXSerializer implements ExtXmlSerializer {
@Override
public void startDocument(String encoding, Boolean standalone)
throws IOException, IllegalArgumentException, IllegalStateException {
super.startDocument(encoding != null ? encoding : mDefaultEncoding,
standalone);
super.startDocument(encoding != null ? encoding : mDefaultEncoding, standalone);
this.newLine();
}
@Override
protected void writeAttributeValue(String value, Writer out)
throws IOException {
protected void writeAttributeValue(String value, Writer out) throws IOException {
if (mIsDisabledAttrEscape) {
out.write(value);
out.write(value == null ? "" : value);
return;
}
super.writeAttributeValue(value, out);
@ -55,8 +53,7 @@ public class ExtMXSerializer extends MXSerializer implements ExtXmlSerializer {
}
@Override
public void setProperty(String name, Object value)
throws IllegalArgumentException, IllegalStateException {
public void setProperty(String name, Object value) throws IllegalArgumentException, IllegalStateException {
if (PROPERTY_DEFAULT_ENCODING.equals(name)) {
mDefaultEncoding = (String) value;
} else {

View File

@ -34,7 +34,7 @@ public final class ResXmlEncoders {
}
public static String encodeAsResXmlAttr(String str) {
if (str.isEmpty()) {
if (str == null || str.isEmpty()) {
return str;
}