SOLR-8246: fix SolrCLI to delete config directory if creating a core failed

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1714764 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shai Erera 2015-11-17 11:56:52 +00:00
parent 830fc1fbfb
commit 64783d1757
2 changed files with 15 additions and 7 deletions

View File

@ -522,6 +522,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

View File

@ -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");
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