This is an automated email from the ASF dual-hosted git repository.
dsmiley pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/main by this push:
new 8de57216453 Fix: Avoid NPE if snapshotMgr failed during core init
(#2879)
8de57216453 is described below
commit 8de5721645344ffa4a34ea6886fcc9cd3d25b45a
Author: Andrey Bozhko <[email protected]>
AuthorDate: Thu Nov 21 15:52:35 2024 -0600
Fix: Avoid NPE if snapshotMgr failed during core init (#2879)
---
solr/core/src/java/org/apache/solr/core/SolrCore.java | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/solr/core/src/java/org/apache/solr/core/SolrCore.java
b/solr/core/src/java/org/apache/solr/core/SolrCore.java
index 55325568abe..749436a0e8c 100644
--- a/solr/core/src/java/org/apache/solr/core/SolrCore.java
+++ b/solr/core/src/java/org/apache/solr/core/SolrCore.java
@@ -1838,13 +1838,15 @@ public class SolrCore implements SolrInfoBean,
Closeable {
}
// 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;
+ }
}
}