Skip to content

Commit

Permalink
avoid NPE if snapshotMgr failed during init
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreyBozhko authored Nov 19, 2024
1 parent e1f56b3 commit 9cf74e3
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions solr/core/src/java/org/apache/solr/core/SolrCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -1840,13 +1840,15 @@ private void doClose() {
}

// Close the snapshots meta-data directory.
Directory snapshotsDir = snapshotMgr.getSnapshotsDir();
try {
this.directoryFactory.release(snapshotsDir);
} catch (Throwable e) {
log.error("Exception releasing snapshotsDir {}", snapshotsDir, e);
if (e instanceof Error) {
throw (Error) e;
if (snapshotMgr != null) {
Directory snapshotsDir = snapshotMgr.getSnapshotsDir();
try {
this.directoryFactory.release(snapshotsDir);
} catch (Throwable e) {
log.error("Exception releasing snapshotsDir {}", snapshotsDir, e);
if (e instanceof Error) {
throw (Error) e;
}
}
}

Expand Down

0 comments on commit 9cf74e3

Please sign in to comment.