From da5d4128bfbee8c06ea9f1921c9414b6f2471ddf Mon Sep 17 00:00:00 2001 From: orbiter Date: Tue, 25 Feb 2014 03:26:20 +0100 Subject: [PATCH] prevent npe --- htroot/HostBrowser.java | 4 +++- source/net/yacy/crawler/CrawlStacker.java | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/htroot/HostBrowser.java b/htroot/HostBrowser.java index b82d0807e..43f1b4d4d 100644 --- a/htroot/HostBrowser.java +++ b/htroot/HostBrowser.java @@ -58,6 +58,7 @@ import net.yacy.search.index.Fulltext; import net.yacy.search.index.Segment.ReferenceReport; import net.yacy.search.index.Segment.ReferenceReportCache; import net.yacy.search.query.QueryParams; +import net.yacy.search.schema.CollectionConfiguration.FailDoc; import net.yacy.search.schema.CollectionSchema; import net.yacy.server.serverObjects; import net.yacy.server.serverSwitch; @@ -463,7 +464,8 @@ public class HostBrowser { FailType failType = errorDocs.get(entry.getKey()); if (failType == null) { // maybe this is only in the errorURL - prop.putHTML("files_list_" + c + "_type_stored_error", process == HarvestProcess.ERRORS ? sb.crawlQueues.errorURL.get(ASCII.String(uri.hash())).getFailReason() : "unknown error"); + FailDoc faildoc = sb.crawlQueues.errorURL.get(ASCII.String(uri.hash())); + prop.putHTML("files_list_" + c + "_type_stored_error", process == HarvestProcess.ERRORS && faildoc != null ? faildoc.getFailReason() : "unknown error"); } else { String ids = ASCII.String(uri.hash()); InfoCacheEntry ice = infoCache.get(ids); diff --git a/source/net/yacy/crawler/CrawlStacker.java b/source/net/yacy/crawler/CrawlStacker.java index 5f69eeda0..6832127bb 100644 --- a/source/net/yacy/crawler/CrawlStacker.java +++ b/source/net/yacy/crawler/CrawlStacker.java @@ -422,8 +422,8 @@ public final class CrawlStacker { } if (dbocc == HarvestProcess.ERRORS) { final CollectionConfiguration.FailDoc errorEntry = this.nextQueue.errorURL.get(urlhash); - if (CrawlStacker.log.isInfo()) CrawlStacker.log.info("URL '" + urlstring + "' is double registered in '" + dbocc.toString() + "', previous cause: " + errorEntry.getFailReason()); - return "double in: errors (" + errorEntry.getFailReason() + "), oldDate = " + oldDate.toString(); + if (CrawlStacker.log.isInfo()) CrawlStacker.log.info("URL '" + urlstring + "' is double registered in '" + dbocc.toString() + "', previous cause: " + (errorEntry == null ? "NULL" : errorEntry.getFailReason())); + return "double in: errors (" + (errorEntry == null ? "NULL" : errorEntry.getFailReason()) + "), oldDate = " + oldDate.toString(); } if (CrawlStacker.log.isInfo()) CrawlStacker.log.info("URL '" + urlstring + "' is double registered in '" + dbocc.toString() + "'. "); return "double in: " + dbocc.toString() + ", oldDate = " + oldDate.toString();