This is an automated email from the ASF dual-hosted git repository.

houston 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 03efd00  SOLR-15950: Fix auto-creation of filestore in constructor. 
(#653)
03efd00 is described below

commit 03efd00a4fe2b5f946cf539c3ef831ff55d4f07b
Author: Houston Putman <[email protected]>
AuthorDate: Mon Feb 21 16:53:28 2022 -0500

    SOLR-15950: Fix auto-creation of filestore in constructor. (#653)
---
 .../org/apache/solr/filestore/DistribPackageStore.java  | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

diff --git 
a/solr/core/src/java/org/apache/solr/filestore/DistribPackageStore.java 
b/solr/core/src/java/org/apache/solr/filestore/DistribPackageStore.java
index 775c009..2c90dbf 100644
--- a/solr/core/src/java/org/apache/solr/filestore/DistribPackageStore.java
+++ b/solr/core/src/java/org/apache/solr/filestore/DistribPackageStore.java
@@ -80,7 +80,6 @@ public class DistribPackageStore implements PackageStore {
   public DistribPackageStore(CoreContainer coreContainer) {
     this.coreContainer = coreContainer;
     this.solrhome = Paths.get(this.coreContainer.getSolrHome());
-    ensurePackageStoreDir(Paths.get(coreContainer.getSolrHome()));
   }
 
   @Override
@@ -563,20 +562,6 @@ public class DistribPackageStore implements PackageStore {
     return file.charAt(0) == '.' && file.endsWith(".json");
   }
 
-  private void ensurePackageStoreDir(Path solrHome) {
-    final File packageStoreDir = getPackageStoreDirPath(solrHome).toFile();
-    if (!packageStoreDir.exists()) {
-      try {
-        final boolean created = packageStoreDir.mkdirs();
-        if (!created) {
-          log.warn("Unable to create [{}] directory in SOLR_HOME [{}].  
Features requiring this directory may fail.", packageStoreDir, solrHome);
-        }
-      } catch (Exception e) {
-        log.warn("Unable to create [{}] directory in SOLR_HOME [{}].  Features 
requiring this directory may fail.", packageStoreDir, solrHome, e);
-      }
-    }
-  }
-
   public static synchronized Path getPackageStoreDirPath(Path solrHome) {
     var path = solrHome.resolve(PackageStoreAPI.PACKAGESTORE_DIRECTORY);
     if (!Files.exists(path)) {
@@ -584,7 +569,7 @@ public class DistribPackageStore implements PackageStore {
         Files.createDirectories(path);
         log.info("Created filestore folder {}", path);
       } catch (IOException e) {
-        throw new SolrException(SERVER_ERROR, "Faild creating 'filestore' 
folder in SOLR_HOME", e);
+        throw new SolrException(SERVER_ERROR, "Failed creating 'filestore' 
folder in SOLR_HOME", e);
       }
     }
     return path;

Reply via email to