SOLR-4915: The root cause should be returned to the user when a SolrCore create call fails.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1492693 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2013-06-13 14:49:39 +00:00
parent e7cdd1959f
commit af2128c683
2 changed files with 19 additions and 1 deletions

View File

@ -136,6 +136,9 @@ Bug Fixes
if a SQLException is thrown while initializing a connection, such as in setAutoCommit(), the
connection will not be closed. (Chris Eldredge via shalin)
* SOLR-4915: The root cause should be returned to the user when a SolrCore create call fails.
(Mark Miller)
Other Changes
----------------------

View File

@ -524,9 +524,24 @@ public class CoreAdminHandler extends RequestHandlerBase {
SolrException.log(log, null, e);
}
}
Throwable tc = ex;
Throwable c = null;
do {
tc = tc.getCause();
if (tc != null) {
c = tc;
}
} while (tc != null);
String rootMsg = "";
if (c != null) {
rootMsg = " Caused by: " + c.getMessage();
}
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
"Error CREATEing SolrCore '" + name + "': " +
ex.getMessage(), ex);
ex.getMessage() + rootMsg, ex);
}
}