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) { public static void main(final String[] s) {
if (s.length == 0) { if (s.length == 0) {
ConcurrentLog.info("WIKITRANSLATION", "usage:"); System.out.println("usage:");
ConcurrentLog.info("WIKITRANSLATION", " -index <wikipedia-dump>"); System.out.println(" -index <wikipedia-dump>");
ConcurrentLog.info("WIKITRANSLATION", " -read <start> <len> <idx-file>"); System.out.println(" -read <start> <len> <idx-file>");
ConcurrentLog.info("WIKITRANSLATION", " -find <title> <wikipedia-dump>"); System.out.println(" -find <title> <wikipedia-dump>");
ConcurrentLog.info("WIKITRANSLATION", " -convert <wikipedia-dump-xml.bz2> <convert-target-dir> <url-stub>"); System.out.println(" -convert <wikipedia-dump-xml.bz2> <convert-target-dir> <url-stub>");
System.exit(0); ConcurrentLog.shutdown();
return;
} }
try {
// example: // 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) { if (s[0].equals("-convert") && s.length > 2) {
final File sourcefile = new File(s[1]); 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