mirror of https://github.com/apache/lucene.git
defense against NPE
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1156201 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8c83a10317
commit
9c1d10c4e9
|
@ -403,12 +403,20 @@ public class CoreAdminHandler extends RequestHandlerBase {
|
|||
@Override
|
||||
public void postClose(SolrCore core) {
|
||||
File dataDir = new File(core.getIndexDir());
|
||||
for (File file : dataDir.listFiles()) {
|
||||
if (!file.delete()) {
|
||||
log.error(file.getAbsolutePath() + " could not be deleted on core unload");
|
||||
File[] files = dataDir.listFiles();
|
||||
if (files != null) {
|
||||
for (File file : files) {
|
||||
if (!file.delete()) {
|
||||
log.error(file.getAbsolutePath()
|
||||
+ " could not be deleted on core unload");
|
||||
}
|
||||
}
|
||||
if (!dataDir.delete()) log.error(dataDir.getAbsolutePath()
|
||||
+ " could not be deleted on core unload");
|
||||
} else {
|
||||
log.error(dataDir.getAbsolutePath()
|
||||
+ " could not be deleted on core unload");
|
||||
}
|
||||
if (!dataDir.delete()) log.error(dataDir.getAbsolutePath() + " could not be deleted on core unload");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue