Skip to content

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

fix for latest commit

Michael Peter Christen8106ab2be02d
diff --git a/source/net/yacy/document/importer/WarcImporter.java b/source/net/yacy/document/importer/WarcImporter.java
index 2b8bdbd05..2c6a303fe 100644
--- a/source/net/yacy/document/importer/WarcImporter.java
+++ b/source/net/yacy/document/importer/WarcImporter.java
@@ -22,7 +22,6 @@
*/
package net.yacy.document.importer;
-import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -97,17 +96,12 @@ public class WarcImporter extends Thread implements Importer {
this.collection = collection;
}
- public WarcImporter(File f, byte[] data, String collection) throws IOException {
+ public WarcImporter(File f, String collection) throws IOException {
super("WarcImporter - from file " + f.getName());
this.name = f.getName();
- if (!f.exists() && data != null) {
- this.sourceSize = data.length;
- this.source = new ByteArrayInputStream(data);
- } else {
- this.sourceSize = f.length();
- this.source = new FileInputStream(f);
- if (this.name.endsWith(".gz")) this.source = new GZIPInputStream(this.source);
- }
+ this.sourceSize = f.length();
+ this.source = new FileInputStream(f);
+ if (this.name.endsWith(".gz")) this.source = new GZIPInputStream(this.source);
this.collection = collection;
}
diff --git a/source/net/yacy/document/importer/ZimImporter.java b/source/net/yacy/document/importer/ZimImporter.java
index 6d0fcc8c3..ee477af55 100644
--- a/source/net/yacy/document/importer/ZimImporter.java
+++ b/source/net/yacy/document/importer/ZimImporter.java
@@ -84,19 +84,11 @@ public class ZimImporter extends Thread implements Importer {
private long consumed;
private boolean abort = false;
- public ZimImporter(String path, byte[] data, String collection) throws IOException {
+ public ZimImporter(String path, String collection) throws IOException {
super("ZimImporter - from file " + path);
this.path = path;
- File zimFilePath = new File(path);
- if (!zimFilePath.exists() && data != null) {
- File tempFile = File.createTempFile(zimFilePath.getName().substring(0, zimFilePath.getName().length() - 4), "zim");
- FileUtils.writeByteArrayToFile(tempFile, data);
- tempFile.deleteOnExit();
- this.file = new ZIMFile(tempFile.getPath());
- } else {
- this.file = new ZIMFile(this.path); // this will read already some of the metadata and could consume some time
- }
- this.sourceSize = data == null ? this.file.length() : data.length;
+ this.file = new ZIMFile(this.path); // this will read already some of the metadata and could consume some time
+ this.sourceSize = this.file.length();
this.collection = collection;
}
diff --git a/source/net/yacy/search/Switchboard.java b/source/net/yacy/search/Switchboard.java
index 5a633e310..ffa72bee1 100644
--- a/source/net/yacy/search/Switchboard.java
+++ b/source/net/yacy/search/Switchboard.java
@@ -2156,7 +2156,7 @@ public final class Switchboard extends serverSwitch {
return moved;
} else if (inFileName.endsWith(".warc") || inFileName.endsWith(".warc.gz")) {
try {
- final WarcImporter wri = new WarcImporter(infile, null, collectionName);
+ final WarcImporter wri = new WarcImporter(infile, collectionName);
wri.start();
try {
wri.join();
@@ -2170,7 +2170,7 @@ public final class Switchboard extends serverSwitch {
return moved;
} else if (inFileName.endsWith(".zim")) {
try {
- final ZimImporter wri = new ZimImporter(infile.getAbsolutePath(), null, collectionName);
+ final ZimImporter wri = new ZimImporter(infile.getAbsolutePath(), collectionName);
wri.start();
try {
wri.join();