]> gitweb.fperrin.net Git - DictionaryPC.git/commitdiff
Get rid of xerces dependency.
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>
Mon, 13 Apr 2020 13:42:17 +0000 (15:42 +0200)
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>
Mon, 13 Apr 2020 13:42:17 +0000 (15:42 +0200)
Relying on the standard XML implementation is a lot slower,
but the WiktionarySplitter run still only takes a few minutes.

.classpath
WiktionarySplitter.sh
compile.sh
run.sh
src/com/hughes/android/dictionary/engine/WiktionarySplitter.java

index c9a63edd3f5fb80381ab9ce1e041cd19e01419fa..96fa3642f1494a62fa10a8aa21ceb5f3eb3ab1f1 100755 (executable)
@@ -6,11 +6,11 @@
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
                <attributes>
                        <attribute name="module" value="true"/>
+                       <attribute name="limit-modules" value="java.xml,java.logging"/>
                </attributes>
        </classpathentry>
        <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
        <classpathentry kind="lib" path="/usr/share/java/icu4j-49.1.jar"/>
-       <classpathentry kind="lib" path="/usr/share/java/xercesImpl.jar"/>
        <classpathentry kind="lib" path="/usr/share/java/commons-text.jar"/>
        <classpathentry kind="lib" path="/usr/share/java/commons-compress.jar"/>
        <classpathentry kind="output" path="bin"/>
index fb1ea66b435a2553b72b104013f45e59e0315d73..87593bb879c422b6c039cb54bb393ec1456c6aaf 100755 (executable)
@@ -2,9 +2,7 @@
 # per-language data files from enwiktionary.
 ICU4J=/usr/share/java/icu4j-49.1.jar
 test -r "$ICU4J" || ICU4J=/usr/share/icu4j-55/lib/icu4j.jar
-XERCES=/usr/share/java/xercesImpl.jar
-test -r "$XERCES" || XERCES=/usr/share/xerces-2/lib/xercesImpl.jar
 COMMONS_COMPRESS=/usr/share/java/commons-compress.jar
 JAVA=/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
 test -x "$JAVA" || JAVA=java
-"$JAVA" -Xmx4096m -Xverify:none -classpath bin/:"$ICU4J":"$XERCES":"$COMMONS_COMPRESS" com.hughes.android.dictionary.engine.WiktionarySplitter "$@"
+"$JAVA" -Xmx4096m -Xverify:none -classpath bin/:"$ICU4J":"$COMMONS_COMPRESS" com.hughes.android.dictionary.engine.WiktionarySplitter "$@"
index 28a6b8e9a448a1ac1da0de78bf0a41f744319f53..7c1ad839c6da60892a1f2e45b39c9b22ab79cdae 100755 (executable)
@@ -33,4 +33,4 @@ fi
 mkdir -p bin
 # -encoding is just a work around for user that still run systems
 # with non-UTF8 locales
-javac -Xlint:all -encoding UTF-8 -g -d bin/ ../Dictionary/Util/src/com/hughes/util/*.java ../Dictionary/Util/src/com/hughes/util/raf/*.java ../Dictionary/src/com/hughes/android/dictionary/DictionaryInfo.java ../Dictionary/src/com/hughes/android/dictionary/engine/*.java ../Dictionary/src/com/hughes/android/dictionary/C.java src/com/hughes/util/*.java src/com/hughes/android/dictionary/*.java src/com/hughes/android/dictionary/*/*.java src/com/hughes/android/dictionary/*/*/*.java -classpath "$ICU4J:$JUNIT:$XERCES:$COMMONS:$COMMONS_COMPRESS"
+javac --limit-modules java.xml,java.logging -Xlint:all -encoding UTF-8 -g -d bin/ ../Dictionary/Util/src/com/hughes/util/*.java ../Dictionary/Util/src/com/hughes/util/raf/*.java ../Dictionary/src/com/hughes/android/dictionary/DictionaryInfo.java ../Dictionary/src/com/hughes/android/dictionary/engine/*.java ../Dictionary/src/com/hughes/android/dictionary/C.java src/com/hughes/util/*.java src/com/hughes/android/dictionary/*.java src/com/hughes/android/dictionary/*/*.java src/com/hughes/android/dictionary/*/*/*.java -classpath "$ICU4J:$JUNIT:$COMMONS:$COMMONS_COMPRESS"
diff --git a/run.sh b/run.sh
index 99113e7471da48c2826735781deb36ec661495f7..fe03ef5662bdadf340d9f9fd602c9bb35f09b3a0 100755 (executable)
--- a/run.sh
+++ b/run.sh
@@ -1,10 +1,8 @@
 # -agentlib:hprof=heap=sites,depth=20
 ICU4J=/usr/share/java/icu4j-49.1.jar
 test -r "$ICU4J" || ICU4J=/usr/share/icu4j-55/lib/icu4j.jar
-XERCES=/usr/share/java/xercesImpl.jar
-test -r "$XERCES" || XERCES=/usr/share/xerces-2/lib/xercesImpl.jar
 COMMONS=/usr/share/java/commons-text.jar
 COMMONS_COMPRESS=/usr/share/java/commons-compress.jar
 JAVA=/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
 test -x "$JAVA" || JAVA=java
-"$JAVA" -Djava.util.logging.config.file="logging.properties" -Xmx4096m -classpath bin/:"$ICU4J":"$XERCES":"$COMMONS":"$COMMONS_COMPRESS" com.hughes.android.dictionary.engine.DictionaryBuilder "$@"
+"$JAVA" -Djava.util.logging.config.file="logging.properties" -Xmx4096m -classpath bin/:"$ICU4J":"$COMMONS":"$COMMONS_COMPRESS" com.hughes.android.dictionary.engine.DictionaryBuilder "$@"
index 12422fd93e1ad2f84c2252c34dc6dc76a7619127..cc9a3b1a0bc6ee56110dfded92cec93a50b83301 100644 (file)
@@ -32,9 +32,9 @@ import java.util.regex.Pattern;
 
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
 
 import org.apache.commons.compress.compressors.CompressorStreamFactory;
-import org.apache.xerces.jaxp.SAXParserFactoryImpl;
 import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
 
@@ -75,7 +75,7 @@ public class WiktionarySplitter extends org.xml.sax.helpers.DefaultHandler {
     }
 
     private void go() throws Exception {
-        final SAXParser parser = SAXParserFactoryImpl.newInstance().newSAXParser();
+        final SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
 
         // Configure things.
         for (final Map.Entry<String, List<Selector>> pathToSelectorsEntry : pathToSelectors.entrySet()) {
@@ -354,7 +354,7 @@ public class WiktionarySplitter extends org.xml.sax.helpers.DefaultHandler {
 
     public void parse(final File file) throws ParserConfigurationException,
         SAXException, IOException {
-        final SAXParser parser = SAXParserFactoryImpl.newInstance().newSAXParser();
+        final SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
         parser.parse(file, this);
     }