From a0c3fcdae0316759202d59550555c36cad4b6241 Mon Sep 17 00:00:00 2001 From: Noah Levitt Date: Mon, 23 Feb 2015 14:09:17 -0800 Subject: [PATCH] avoid java.lang.NullPointerException at org.archive.modules.writer.WriterPoolProcessor.copyForwardWriteTagIfDupe(WriterPoolProcessor.java:504); this exception has not always been possible, but is possible now because IdenticalDigestDecideRule.hasIdenticalDigest(curi) can return true even if there is no curi.getFetchHistory(), since uri-agnostic dedup doesn't use fetchHistory --- .../java/org/archive/modules/writer/WriterPoolProcessor.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/src/main/java/org/archive/modules/writer/WriterPoolProcessor.java b/modules/src/main/java/org/archive/modules/writer/WriterPoolProcessor.java index 99ee6589..e5f704e2 100644 --- a/modules/src/main/java/org/archive/modules/writer/WriterPoolProcessor.java +++ b/modules/src/main/java/org/archive/modules/writer/WriterPoolProcessor.java @@ -47,7 +47,6 @@ import org.archive.modules.net.CrawlHost; import org.archive.modules.net.ServerCache; import org.archive.spring.ConfigPath; import org.archive.util.FileUtils; -import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; @@ -501,7 +500,7 @@ implements Lifecycle, Checkpointable, WriterPoolSettings { protected void copyForwardWriteTagIfDupe(CrawlURI curi) { if (IdenticalDigestDecideRule.hasIdenticalDigest(curi)) { Map[] history = curi.getFetchHistory(); - if (history[1].containsKey(A_WRITE_TAG)) { + if (history != null && history[1].containsKey(A_WRITE_TAG)) { history[0].put(A_WRITE_TAG, history[1].get(A_WRITE_TAG)); } }