From 7b608c2e1ff10555f7d3a3af0b5af81aa2fd14f9 Mon Sep 17 00:00:00 2001 From: Erick Erickson Date: Fri, 15 Nov 2013 00:48:08 +0000 Subject: [PATCH] SOLR-5441: the null-pointer patch addition git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1542142 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/solr/update/DirectUpdateHandler2.java | 6 ++++-- .../src/java/org/apache/solr/update/TransactionLog.java | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java b/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java index 5d1a67ccae4..ea9ea298353 100644 --- a/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java +++ b/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java @@ -842,8 +842,10 @@ public class DirectUpdateHandler2 extends UpdateHandler implements SolrCoreState lst.add("cumulative_deletesById", deleteByIdCommandsCumulative.get()); lst.add("cumulative_deletesByQuery", deleteByQueryCommandsCumulative.get()); lst.add("cumulative_errors", numErrorsCumulative.get()); - lst.add("transaction_logs_total_size", ulog.getTotalLogsSize()); - lst.add("transaction_logs_total_number", ulog.getTotalLogsNumber()); + if (this.ulog != null) { + lst.add("transaction_logs_total_size", ulog.getTotalLogsSize()); + lst.add("transaction_logs_total_number", ulog.getTotalLogsNumber()); + } return lst; } diff --git a/solr/core/src/java/org/apache/solr/update/TransactionLog.java b/solr/core/src/java/org/apache/solr/update/TransactionLog.java index ac13dd172d9..a9cefc657aa 100644 --- a/solr/core/src/java/org/apache/solr/update/TransactionLog.java +++ b/solr/core/src/java/org/apache/solr/update/TransactionLog.java @@ -564,7 +564,10 @@ public class TransactionLog { } public long getLogSize() { - return tlogFile.length(); + if (tlogFile != null) { + return tlogFile.length(); + } + return 0; } /** Returns a reader that can be used while a log is still in use. @@ -579,7 +582,6 @@ public class TransactionLog { return new FSReverseReader(); } - public class LogReader { private ChannelFastInputStream fis; private LogCodec codec = new LogCodec(resolver);