From 1389f64fbe6f68552b44b380ae8d770fd5075c8c Mon Sep 17 00:00:00 2001 From: Mark Robert Miller Date: Tue, 18 Dec 2012 20:30:09 +0000 Subject: [PATCH] SOLR-4203: whoops - fix npe git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1423625 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/solr/update/UpdateHandler.java | 3 ++- .../src/java/org/apache/solr/update/UpdateLog.java | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/solr/core/src/java/org/apache/solr/update/UpdateHandler.java b/solr/core/src/java/org/apache/solr/update/UpdateHandler.java index 9eef54bc424..5f343658087 100644 --- a/solr/core/src/java/org/apache/solr/update/UpdateHandler.java +++ b/solr/core/src/java/org/apache/solr/update/UpdateHandler.java @@ -85,7 +85,8 @@ public abstract class UpdateHandler implements SolrInfoMBean { // not thread safe - for startup private void clearLog(PluginInfo ulogPluginInfo) { - File tlogDir = UpdateLog.getTlogDir(ulogPluginInfo); + if (ulogPluginInfo == null) return; + File tlogDir = UpdateLog.getTlogDir(core, ulogPluginInfo); if (tlogDir.exists()) { String[] files = UpdateLog.getLogList(tlogDir); for (String file : files) { diff --git a/solr/core/src/java/org/apache/solr/update/UpdateLog.java b/solr/core/src/java/org/apache/solr/update/UpdateLog.java index 6c87e95df83..bc761ea41f6 100644 --- a/solr/core/src/java/org/apache/solr/update/UpdateLog.java +++ b/solr/core/src/java/org/apache/solr/update/UpdateLog.java @@ -1395,8 +1395,18 @@ public class UpdateLog implements PluginInfoInitialized { } } - public static File getTlogDir(PluginInfo info) { - String dataDir = (String)info.initArgs.get("dir"); + public static File getTlogDir(SolrCore core, PluginInfo info) { + String dataDir = (String) info.initArgs.get("dir"); + if (dataDir == null) { + String ulogDir = core.getCoreDescriptor().getUlogDir(); + if (ulogDir != null) { + dataDir = ulogDir; + } + + if (dataDir == null || dataDir.length() == 0) { + dataDir = core.getDataDir(); + } + } return new File(dataDir, TLOG_NAME); }