summaryrefslogtreecommitdiffstats
path: root/xml
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2010-12-08 19:19:13 -0800
committerElliott Hughes <enh@google.com>2010-12-08 19:19:13 -0800
commit866e7ae17a3da81a02b0b144e0c9c2b3196d293a (patch)
treed72bc28511f7796290a60b63c732e020d029e29c /xml
parentc8104b0342382481704c6662af33968595ad6ab6 (diff)
downloadlibcore-866e7ae17a3da81a02b0b144e0c9c2b3196d293a.zip
libcore-866e7ae17a3da81a02b0b144e0c9c2b3196d293a.tar.gz
libcore-866e7ae17a3da81a02b0b144e0c9c2b3196d293a.tar.bz2
Fix a bunch of javac -Xlint warnings in our code.
I think "fallthrough" uncovered a couple of real bugs in the kxml code, but other than that there's nothing very exciting here. This addresses all but one of the non-xml warnings. I'm assuming that we'll move the xml cruft out into external at some point (since we're deliberately not maintaining it). Change-Id: Ice81253b019df7b19d6557e719663b7bdc11fb22
Diffstat (limited to 'xml')
-rw-r--r--xml/src/main/java/org/kxml2/io/KXmlParser.java5
-rw-r--r--xml/src/main/java/org/kxml2/io/KXmlSerializer.java15
2 files changed, 7 insertions, 13 deletions
diff --git a/xml/src/main/java/org/kxml2/io/KXmlParser.java b/xml/src/main/java/org/kxml2/io/KXmlParser.java
index 5cd2810..9fb858b 100644
--- a/xml/src/main/java/org/kxml2/io/KXmlParser.java
+++ b/xml/src/main/java/org/kxml2/io/KXmlParser.java
@@ -992,14 +992,14 @@ public class KXmlParser implements XmlPullParser, Closeable {
return ELEMENTDECL; // <!EL
case 'N':
return ENTITYDECL; // <!EN
- default:
- throw new XmlPullParserException("Unexpected <!", this, null);
}
+ break;
case 'A':
return ATTLISTDECL; // <!A
case 'N':
return NOTATIONDECL; // <!N
}
+ throw new XmlPullParserException("Unexpected <!", this, null);
default:
return START_TAG; // <
}
@@ -1660,6 +1660,7 @@ public class KXmlParser implements XmlPullParser, Closeable {
break;
}
}
+ break;
default:
// handle a byte order mark followed by something other than <?
diff --git a/xml/src/main/java/org/kxml2/io/KXmlSerializer.java b/xml/src/main/java/org/kxml2/io/KXmlSerializer.java
index 68259e0..d676c41 100644
--- a/xml/src/main/java/org/kxml2/io/KXmlSerializer.java
+++ b/xml/src/main/java/org/kxml2/io/KXmlSerializer.java
@@ -91,9 +91,7 @@ public class KXmlSerializer implements XmlSerializer {
writer.write(close ? " />" : ">");
}
- private final void writeEscaped(String s, int quot)
- throws IOException {
-
+ private final void writeEscaped(String s, int quot) throws IOException {
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
switch (c) {
@@ -114,14 +112,11 @@ public class KXmlSerializer implements XmlSerializer {
case '<' :
writer.write("&lt;");
break;
- case '"' :
- case '\'' :
+ default:
if (c == quot) {
- writer.write(
- c == '"' ? "&quot;" : "&apos;");
+ writer.write(c == '"' ? "&quot;" : "&apos;");
break;
}
- default :
// BEGIN android-changed: refuse to output invalid characters
// See http://www.w3.org/TR/REC-xml/#charsets for definition.
// No other Java XML writer we know of does this, but no Java
@@ -164,9 +159,7 @@ public class KXmlSerializer implements XmlSerializer {
public void endDocument() throws IOException {
while (depth > 0) {
- endTag(
- elementStack[depth * 3 - 3],
- elementStack[depth * 3 - 1]);
+ endTag(elementStack[depth * 3 - 3], elementStack[depth * 3 - 1]);
}
flush();
}