Skip to content

Commit

Permalink
Fix: Avoid NPE if snapshotMgr failed during core init (#2879)
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreyBozhko authored Nov 21, 2024
1 parent af26a5d commit 8de5721
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 @@ -1838,13 +1838,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 8de5721

Please sign in to comment.