Removing the use of an external xml parsing lib.
API JDiffs for Google Play services ran across a bug with the
xerces.jar so switching to the native library to resolve.
Change-Id: Ia5f8acbbeff54af51986512505933e83f7919d73
(cherry picked from commit 2f5f31a8f36d12a0cbf4520f213ef325c18d40b3)
diff --git a/build.xml b/build.xml
index 3dd9657..458b40d 100755
--- a/build.xml
+++ b/build.xml
@@ -4,7 +4,6 @@
<description>
Builds Android's jdiff.jar and places it in device/extlibs/jdiff-1.1.0/.
</description>
-
<target name="init" description="Properties used by other targets">
<property name="extlibs.dir" value="${basedir}/../../extlibs/jdiff-1.1.0/" />
@@ -13,9 +12,6 @@
<property name="classes.dir" value="${build.dir}/classes" />
<property name="lib.dir" value="${build.dir}/lib" />
<property name="version" value="1.1.0" />
- <path id="class.path">
- <pathelement location="{basedir}/../../extlibs/xerces.jar" />
- </path>
<property name="debug" value="true" />
<property name="JDIFF_HOME" value="${extlibs.dir}" />
</target>
@@ -39,17 +35,15 @@
destdir="${classes.dir}"
debug="${debug}"
excludes="jdiff/JDiffAntTask.java"
- includeJavaRuntime="yes">
- <classpath>
- <path refid="class.path" />
- </classpath>
-<!--<compilerarg value="-Xlint:unchecked"/> -->
+ fork="true"
+ includeJavaRuntime="false"
+ includeAntRuntime="yes">
</javac>
-</target>
+</target>
<!-- Place the jdiff.jar file in <branch-root>/device/extlibs/jdiff-.1.0/ (under version control) -->
- <target name="jar" depends="compile">
- <jar jarfile="${basedir}/jdiff.jar"
+<target name="jar" depends="compile">
+ <jar jarfile="${basedir}/jdiff.jar"
basedir="${classes.dir}"
includes="*jdiff/*.class"
excludes="*jdiff/JDiffAntTask*.class" />
diff --git a/src/jdiff/XMLToAPI.java b/src/jdiff/XMLToAPI.java
index 8937a66..046da4b 100755
--- a/src/jdiff/XMLToAPI.java
+++ b/src/jdiff/XMLToAPI.java
@@ -2,6 +2,7 @@
import java.io.*;
import java.util.*;
+import javax.xml.parsers.ParserConfigurationException;
/* For SAX parsing in APIHandler */
import org.xml.sax.Attributes;
@@ -47,19 +48,17 @@
XMLReader parser = null;
DefaultHandler handler = new APIHandler(api_, createGlobalComments);
try {
- String parserName = System.getProperty("org.xml.sax.driver");
- if (parserName == null) {
- parser = org.xml.sax.helpers.XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");
- } else {
- // Let the underlying mechanisms try to work out which
- // class to instantiate
- parser = org.xml.sax.helpers.XMLReaderFactory.createXMLReader();
- }
+ parser = javax.xml.parsers.SAXParserFactory.newInstance().newSAXParser().getXMLReader();
} catch (SAXException saxe) {
System.out.println("SAXException: " + saxe);
saxe.printStackTrace();
System.exit(1);
+ } catch (ParserConfigurationException pce) {
+ System.out.println("ParserConfigurationException: " + pce);
+ pce.printStackTrace();
+ System.exit(1);
}
+
if (validateXML) {
parser.setFeature("http://xml.org/sax/features/namespaces", true);
parser.setFeature("http://xml.org/sax/features/validation", true);
diff --git a/xerces.jar b/xerces.jar
deleted file mode 100644
index 8f762e1..0000000
--- a/xerces.jar
+++ /dev/null
Binary files differ