Skip to content

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

fixed crawler bug caused by NPE in logging

orbiter0d81731e8832
diff --git a/source/de/anomic/crawler/CrawlStacker.java b/source/de/anomic/crawler/CrawlStacker.java
index 656d20f4b..0e3fce96e 100644
--- a/source/de/anomic/crawler/CrawlStacker.java
+++ b/source/de/anomic/crawler/CrawlStacker.java
@@ -28,6 +28,7 @@
package de.anomic.crawler;
+import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Date;
@@ -361,9 +362,10 @@ public final class CrawlStacker {
// check if this is a local address and we are allowed to index local pages:
//boolean local = hostAddress.isSiteLocalAddress() || hostAddress.isLoopbackAddress();
//assert local == yacyURL.isLocalDomain(url.hash()); // TODO: remove the dnsResolve above!
+ InetAddress ia = Domains.dnsResolve(host);
return (local) ?
- ("the host '" + host + "' is local, but local addresses are not accepted: " + Domains.dnsResolve(host).getHostAddress()) :
- ("the host '" + host + "' is global, but global addresses are not accepted: " + Domains.dnsResolve(host).getHostAddress());
+ ("the host '" + host + "' is local, but local addresses are not accepted: " + ((ia == null) ? "null" : ia.getHostAddress())) :
+ ("the host '" + host + "' is global, but global addresses are not accepted: " + ((ia == null) ? "null" : ia.getHostAddress()));
}
public String urlInAcceptedDomainHash(final byte[] urlhash) {
diff --git a/source/de/anomic/crawler/ZURL.java b/source/de/anomic/crawler/ZURL.java
index e95afb4da..11ce978c5 100755
--- a/source/de/anomic/crawler/ZURL.java
+++ b/source/de/anomic/crawler/ZURL.java
@@ -132,7 +132,7 @@ public class ZURL implements Iterable<ZURL.Entry> {
Entry entry = new Entry(bentry, executor, workdate, workcount, anycause);
put(entry);
stack.add(entry.hash());
- Log.logInfo("URL Errors", bentry.url().toNormalform(false, false) + " - " + anycause);
+ Log.logInfo("Rejected URL", bentry.url().toNormalform(false, false) + " - " + anycause);
while (stack.size() > maxStackSize) stack.poll();
}