Skip to content

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

fix NPE in index import

Michael Peter Christenb8875b892fc0
diff --git a/source/net/yacy/document/importer/JsonListImporter.java b/source/net/yacy/document/importer/JsonListImporter.java
index 7392f39ae..f82539837 100644
--- a/source/net/yacy/document/importer/JsonListImporter.java
+++ b/source/net/yacy/document/importer/JsonListImporter.java
@@ -89,7 +89,7 @@ public class JsonListImporter extends Thread implements Importer {
@Override
public void run() {
try {
- processSurrogateJson();
+ this.processSurrogateJson();
} catch (final IOException e) {
log.warn(e);
}
@@ -252,8 +252,11 @@ public class JsonListImporter extends Thread implements Importer {
// check if required fields are still missing and compute them
if (!surrogate.containsKey(CollectionSchema.host_s.getSolrFieldName())) {
- final DigestURL durl = new DigestURL((String) surrogate.getFieldValue(CollectionSchema.sku.getSolrFieldName()));
- surrogate.setField(CollectionSchema.host_s.getSolrFieldName(), durl.getHost());
+ final String durls = (String) surrogate.getFieldValue(CollectionSchema.sku.getSolrFieldName());
+ if (durls != null) {
+ final DigestURL durl = new DigestURL(durls);
+ surrogate.setField(CollectionSchema.host_s.getSolrFieldName(), durl.getHost());
+ }
}
// regular situation, just read content of field
@@ -303,7 +306,7 @@ public class JsonListImporter extends Thread implements Importer {
@Override
public int speed() {
if (this.lineCount == 0) return 0;
- return (int) (this.lineCount / Math.max(0L, runningTime() ));
+ return (int) (this.lineCount / Math.max(0L, this.runningTime() ));
}
@Override
@@ -316,7 +319,7 @@ public class JsonListImporter extends Thread implements Importer {
if (this.consumed == 0) {
return 0;
}
- final long speed = this.consumed / runningTime();
+ final long speed = this.consumed / this.runningTime();
return (this.sourceSize - this.consumed) / speed;
}