Updated MediaWimporter main() : display usage in console and stop

properly without calling System.exit
pull/32/head
luc 9 years ago
parent 92df100596
commit 7736ee5a42

@ -750,16 +750,21 @@ public class MediawikiImporter extends Thread implements Importer {
public static void main(final String[] s) {
if (s.length == 0) {
ConcurrentLog.info("WIKITRANSLATION", "usage:");
ConcurrentLog.info("WIKITRANSLATION", " -index <wikipedia-dump>");
ConcurrentLog.info("WIKITRANSLATION", " -read <start> <len> <idx-file>");
ConcurrentLog.info("WIKITRANSLATION", " -find <title> <wikipedia-dump>");
ConcurrentLog.info("WIKITRANSLATION", " -convert <wikipedia-dump-xml.bz2> <convert-target-dir> <url-stub>");
System.exit(0);
System.out.println("usage:");
System.out.println(" -index <wikipedia-dump>");
System.out.println(" -read <start> <len> <idx-file>");
System.out.println(" -find <title> <wikipedia-dump>");
System.out.println(" -convert <wikipedia-dump-xml.bz2> <convert-target-dir> <url-stub>");
ConcurrentLog.shutdown();
return;
}
try {
// example:
// java -Xmx2000m -cp classes:lib/bzip2.jar de.anomic.tools.mediawikiIndex -convert DATA/HTCACHE/dewiki-20090311-pages-articles.xml.bz2 DATA/SURROGATES/in/ http://de.wikipedia.org/wiki/
// java -Xmx2000m -cp classes:lib/bzip2.jar
// de.anomic.tools.mediawikiIndex -convert
// DATA/HTCACHE/dewiki-20090311-pages-articles.xml.bz2
// DATA/SURROGATES/in/ http://de.wikipedia.org/wiki/
if (s[0].equals("-convert") && s.length > 2) {
final File sourcefile = new File(s[1]);
@ -802,7 +807,9 @@ public class MediawikiImporter extends Thread implements Importer {
}
}
System.exit(0);
} finally {
ConcurrentLog.shutdown();
}
}
}

Loading…
Cancel
Save