diff options
author | 2016-06-22 21:34:39 +0000 | |
---|---|---|
committer | 2016-06-23 11:10:28 +0000 | |
commit | 8054bcf9cccdd5e353c67de9a542a774ba2ba048 (patch) | |
tree | 41f6c66c6b7b572efd422dba4e82f4544ba27027 /src/tools/android/java/com/google/devtools/build/android/DataResourceXml.java | |
parent | e1a4a812971f604d51bdf098b6117d9ba03da1c8 (diff) |
Change the BufferedReader to BufferedInputStream, as the UTF-8 bom crashes the BufferedReader.
Add the errors a suppressed exceptions which is more useful for debugging.
--
MOS_MIGRATED_REVID=125609925
Diffstat (limited to 'src/tools/android/java/com/google/devtools/build/android/DataResourceXml.java')
-rw-r--r-- | src/tools/android/java/com/google/devtools/build/android/DataResourceXml.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/tools/android/java/com/google/devtools/build/android/DataResourceXml.java b/src/tools/android/java/com/google/devtools/build/android/DataResourceXml.java index dfc0496476..d1cc857dfa 100644 --- a/src/tools/android/java/com/google/devtools/build/android/DataResourceXml.java +++ b/src/tools/android/java/com/google/devtools/build/android/DataResourceXml.java @@ -32,6 +32,7 @@ import com.google.protobuf.InvalidProtocolBufferException; import com.android.resources.ResourceType; +import java.io.BufferedInputStream; import java.io.IOException; import java.io.OutputStream; import java.nio.charset.StandardCharsets; @@ -78,7 +79,9 @@ public class DataResourceXml implements DataResource { KeyValueConsumer<DataKey, DataResource> combiningConsumer) throws XMLStreamException, FactoryConfigurationError, IOException { XMLEventReader eventReader = - xmlInputFactory.createXMLEventReader(Files.newBufferedReader(path, StandardCharsets.UTF_8)); + xmlInputFactory.createXMLEventReader( + new BufferedInputStream(Files.newInputStream(path)), + StandardCharsets.UTF_8.toString()); try { // TODO(corysmith): Make the xml parsing more readable. while (XmlResourceValues.moveToResources(eventReader)) { |