summaryrefslogtreecommitdiffstats
path: root/services/core/java/com/android/server/job
diff options
context:
space:
mode:
authorWojciech Staszkiewicz <staszkiewicz@google.com>2015-05-08 14:58:46 +0100
committerWojciech Staszkiewicz <staszkiewicz@google.com>2015-05-14 10:24:34 +0100
commit9e9e2e73c6ec7bece20268196dc89ad0c8bafad4 (patch)
treec2bf1f99d8bc64db925a95dcab0b5ddec6b8de41 /services/core/java/com/android/server/job
parent39087b1cec6a54e96ab9eafe8317952720790533 (diff)
downloadframeworks_base-9e9e2e73c6ec7bece20268196dc89ad0c8bafad4.zip
frameworks_base-9e9e2e73c6ec7bece20268196dc89ad0c8bafad4.tar.gz
frameworks_base-9e9e2e73c6ec7bece20268196dc89ad0c8bafad4.tar.bz2
Pass charset to XmlPullParser.setInput instead of null
Passing null to XmlPullParser.setInput forces it to do additional work, which can be easily avoided if we know the charset beforehand. bug: b/20849543 Change-Id: Iaff97be9df2d0f99d7af8f19f65934439c9658e2
Diffstat (limited to 'services/core/java/com/android/server/job')
-rw-r--r--services/core/java/com/android/server/job/JobStore.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/job/JobStore.java b/services/core/java/com/android/server/job/JobStore.java
index b64c677..24d4f15 100644
--- a/services/core/java/com/android/server/job/JobStore.java
+++ b/services/core/java/com/android/server/job/JobStore.java
@@ -41,6 +41,7 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -292,7 +293,7 @@ public class JobStore {
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
XmlSerializer out = new FastXmlSerializer();
- out.setOutput(baos, "utf-8");
+ out.setOutput(baos, StandardCharsets.UTF_8.name());
out.startDocument(null, true);
out.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true);
@@ -450,7 +451,7 @@ public class JobStore {
private List<JobStatus> readJobMapImpl(FileInputStream fis)
throws XmlPullParserException, IOException {
XmlPullParser parser = Xml.newPullParser();
- parser.setInput(fis, null);
+ parser.setInput(fis, StandardCharsets.UTF_8.name());
int eventType = parser.getEventType();
while (eventType != XmlPullParser.START_TAG &&