Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

fix MediawikiImporter for bz2 dump skip reading bz2 file magicbyte to identify bz2 format as inputstream reset would be required. Common compress reads and checks the magicbytes internally and throws ioexception if wrong, making preread obsolete.

regerbbe9df2bb3dc
diff --git a/source/net/yacy/document/importer/MediawikiImporter.java b/source/net/yacy/document/importer/MediawikiImporter.java
index b9557f803..d0d64cc72 100644
--- a/source/net/yacy/document/importer/MediawikiImporter.java
+++ b/source/net/yacy/document/importer/MediawikiImporter.java
@@ -153,16 +153,6 @@ public class MediawikiImporter extends Thread implements Importer {
if (p > 0) targetstub = targetstub.substring(0, p);
InputStream is = new BufferedInputStream(new FileInputStream(this.sourcefile), 1024 * 1024);
if (this.sourcefile.getName().endsWith(".bz2")) {
- int b = is.read();
- if (b != 'B') {
- try {is.close();} catch (final IOException e) {}
- throw new IOException("Invalid bz2 content.");
- }
- b = is.read();
- if (b != 'Z') {
- try {is.close();} catch (final IOException e) {}
- throw new IOException("Invalid bz2 content.");
- }
is = new BZip2CompressorInputStream(is);
} else if (this.sourcefile.getName().endsWith(".gz")) {
is = new GZIPInputStream(is);