SOLR-4203: whoops - fix npe

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1423625 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2012-12-18 20:30:09 +00:00
parent bef4454e2f
commit 1389f64fbe
2 changed files with 14 additions and 3 deletions

View File

@ -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) {

View File

@ -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);
}