You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2015/11/17 12:58:07 UTC
svn commit: r1714765 - in /lucene/dev/branches/branch_5x: ./ solr/
solr/CHANGES.txt solr/core/
solr/core/src/java/org/apache/solr/util/SolrCLI.java
Author: shaie
Date: Tue Nov 17 11:58:07 2015
New Revision: 1714765
URL: http://svn.apache.org/viewvc?rev=1714765&view=rev
Log:
SOLR-8246: fix SolrCLI to delete config directory if creating a core failed
Modified:
lucene/dev/branches/branch_5x/ (props changed)
lucene/dev/branches/branch_5x/solr/ (props changed)
lucene/dev/branches/branch_5x/solr/CHANGES.txt (contents, props changed)
lucene/dev/branches/branch_5x/solr/core/ (props changed)
lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/util/SolrCLI.java
Modified: lucene/dev/branches/branch_5x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/CHANGES.txt?rev=1714765&r1=1714764&r2=1714765&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_5x/solr/CHANGES.txt Tue Nov 17 11:58:07 2015
@@ -378,6 +378,9 @@ Other Changes
* SOLR-8269: Upgrade commons-collections to 3.2.2. This fixes a known serialization vulnerability (janhoy)
+* SOLR-8246: Fix SolrCLI to clean the config directory in case creating a core failed.
+ (Jason Gerlowski via Shai Erera)
+
================== 5.3.1 ==================
Bug Fixes
Modified: lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/util/SolrCLI.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/util/SolrCLI.java?rev=1714765&r1=1714764&r2=1714765&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/util/SolrCLI.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/util/SolrCLI.java Tue Nov 17 11:58:07 2015
@@ -1573,7 +1573,7 @@ public class SolrCLI {
throw new IllegalArgumentException("\n"+configSetDir.getAbsolutePath()+" doesn't contain a conf subdirectory or solrconfig.xml\n");
}
}
- echo("\nSetup new core instance directory:\n" + coreInstanceDir.getAbsolutePath());
+ echo("\nCopying configuration to new core instance directory:\n" + coreInstanceDir.getAbsolutePath());
}
String createCoreUrl =
@@ -1585,12 +1585,17 @@ public class SolrCLI {
echo("\nCreating new core '" + coreName + "' using command:\n" + createCoreUrl + "\n");
- Map<String,Object> json = getJson(createCoreUrl);
-
- CharArr arr = new CharArr();
- new JSONWriter(arr, 2).write(json);
- echo(arr.toString());
- echo("\n");
+ try {
+ Map<String,Object> json = getJson(createCoreUrl);
+ CharArr arr = new CharArr();
+ new JSONWriter(arr, 2).write(json);
+ echo(arr.toString());
+ echo("\n");
+ } catch (Exception e) {
+ /* create-core failed, cleanup the copied configset before propagating the error. */
+ FileUtils.deleteDirectory(coreInstanceDir);
+ throw e;
+ }
}
} // end CreateCoreTool class