diff options
author | Elliott Hughes <enh@google.com> | 2010-05-21 16:58:35 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2010-05-21 16:58:35 -0700 |
commit | 80a7fbab52b96c9fd47c72f8987d1babe2cd001d (patch) | |
tree | 6b0e57162e56812f88f12745548a1645b2dda8fe /xml/src | |
parent | f747d892a728b9ed2cd84a0902b3ecec717c7b95 (diff) | |
download | libcore-80a7fbab52b96c9fd47c72f8987d1babe2cd001d.zip libcore-80a7fbab52b96c9fd47c72f8987d1babe2cd001d.tar.gz libcore-80a7fbab52b96c9fd47c72f8987d1babe2cd001d.tar.bz2 |
Remove more localized exception messages.
I also accidentally mixed two unrelated changes in here: replacing "".equals
and equals("") with String.isEmpty, and removing some dead code in
org.apache.harmony.luni.util.Util.
Change-Id: I0aaad43290b083085b3095b624caf096de487223
Diffstat (limited to 'xml/src')
-rw-r--r-- | xml/src/main/java/org/kxml2/io/KXmlParser.java | 2 | ||||
-rw-r--r-- | xml/src/main/java/org/kxml2/io/KXmlSerializer.java | 24 |
2 files changed, 12 insertions, 14 deletions
diff --git a/xml/src/main/java/org/kxml2/io/KXmlParser.java b/xml/src/main/java/org/kxml2/io/KXmlParser.java index 66e7fb2..dd73f0b 100644 --- a/xml/src/main/java/org/kxml2/io/KXmlParser.java +++ b/xml/src/main/java/org/kxml2/io/KXmlParser.java @@ -163,7 +163,7 @@ public class KXmlParser implements XmlPullParser { nspStack[j] = attrName; nspStack[j + 1] = attributes[i + 3]; - if (attrName != null && attributes[i + 3].equals("")) + if (attrName != null && attributes[i + 3].isEmpty()) error("illegal empty namespace"); // prefixMap = new PrefixMap (prefixMap, attrName, attr.getValue ()); diff --git a/xml/src/main/java/org/kxml2/io/KXmlSerializer.java b/xml/src/main/java/org/kxml2/io/KXmlSerializer.java index 4ad78bf..c467e40 100644 --- a/xml/src/main/java/org/kxml2/io/KXmlSerializer.java +++ b/xml/src/main/java/org/kxml2/io/KXmlSerializer.java @@ -65,16 +65,14 @@ public class KXmlSerializer implements XmlSerializer { } indent[depth] = indent[depth - 1]; - for (int i = nspCounts[depth - 1]; - i < nspCounts[depth]; - i++) { + for (int i = nspCounts[depth - 1]; i < nspCounts[depth]; i++) { writer.write(' '); writer.write("xmlns"); - if (!"".equals(nspStack[i * 2])) { + if (!nspStack[i * 2].isEmpty()) { writer.write(':'); writer.write(nspStack[i * 2]); } - else if ("".equals(getNamespace()) && !"".equals(nspStack[i * 2 + 1])) + else if (getNamespace().isEmpty() && !nspStack[i * 2 + 1].isEmpty()) throw new IllegalStateException("Cannot set default namespace for elements in no namespace"); writer.write("=\""); writeEscaped(nspStack[i * 2 + 1], '"'); @@ -209,7 +207,7 @@ public class KXmlSerializer implements XmlSerializer { i >= 0; i -= 2) { if (nspStack[i + 1].equals(namespace) - && (includeDefault || !nspStack[i].equals(""))) { + && (includeDefault || !nspStack[i].isEmpty())) { String cand = nspStack[i]; for (int j = i + 2; j < nspCounts[depth + 1] * 2; @@ -229,7 +227,7 @@ public class KXmlSerializer implements XmlSerializer { String prefix; - if ("".equals(namespace)) + if (namespace.isEmpty()) prefix = ""; else { do { @@ -399,11 +397,11 @@ public class KXmlSerializer implements XmlSerializer { ? "" : getPrefix(namespace, true, true); - if ("".equals(namespace)) { + if (namespace.isEmpty()) { for (int i = nspCounts[depth]; i < nspCounts[depth + 1]; i++) { - if ("".equals(nspStack[i * 2]) && !"".equals(nspStack[i * 2 + 1])) { + if (nspStack[i * 2].isEmpty() && !nspStack[i * 2 + 1].isEmpty()) { throw new IllegalStateException("Cannot set default namespace for elements in no namespace"); } } @@ -414,7 +412,7 @@ public class KXmlSerializer implements XmlSerializer { elementStack[esp] = name; writer.write('<'); - if (!"".equals(prefix)) { + if (!prefix.isEmpty()) { writer.write(prefix); writer.write(':'); } @@ -443,7 +441,7 @@ public class KXmlSerializer implements XmlSerializer { // pending = false; String prefix = - "".equals(namespace) + namespace.isEmpty() ? "" : getPrefix(namespace, false, true); @@ -464,7 +462,7 @@ public class KXmlSerializer implements XmlSerializer { */ writer.write(' '); - if (!"".equals(prefix)) { + if (!prefix.isEmpty()) { writer.write(prefix); writer.write(':'); } @@ -516,7 +514,7 @@ public class KXmlSerializer implements XmlSerializer { writer.write("</"); String prefix = elementStack[depth * 3 + 1]; - if (!"".equals(prefix)) { + if (!prefix.isEmpty()) { writer.write(prefix); writer.write(':'); } |