mirror of https://github.com/apache/lucene.git
SOLR-10272: Fixing precommit
This commit is contained in:
parent
54fc1ee44d
commit
e4d0bb7dc4
|
@ -50,6 +50,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
|||
|
||||
import com.google.common.base.Strings;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.lucene.util.SuppressForbidden;
|
||||
import org.apache.solr.client.solrj.impl.HttpSolrClient;
|
||||
import org.apache.solr.client.solrj.impl.HttpSolrClient.Builder;
|
||||
import org.apache.solr.client.solrj.request.CoreAdminRequest.WaitForState;
|
||||
|
@ -695,7 +696,7 @@ public class ZkController {
|
|||
* Gets the absolute filesystem path of the _default configset to bootstrap from.
|
||||
* First tries the sysprop "solr.default.confdir". If not found, tries to find
|
||||
* the _default dir relative to the sysprop "solr.install.dir".
|
||||
* If that fails as well, tries to get the _default from the
|
||||
* If that fails as well (usually for unit tests), tries to get the _default from the
|
||||
* classpath. Returns null if not found anywhere.
|
||||
*/
|
||||
private static String getDefaultConfigDirPath() {
|
||||
|
@ -710,16 +711,23 @@ public class ZkController {
|
|||
new File(System.getProperty(SolrDispatchFilter.SOLR_INSTALL_DIR_ATTRIBUTE) + subPath).exists()) {
|
||||
configDirPath = new File(System.getProperty(SolrDispatchFilter.SOLR_INSTALL_DIR_ATTRIBUTE) + subPath).getAbsolutePath();
|
||||
} else { // find "_default" in the classpath. This one is used for tests
|
||||
URL classpathUrl = Thread.currentThread().getContextClassLoader().getResource(serverSubPath);
|
||||
try {
|
||||
if (classpathUrl != null && new File(classpathUrl.toURI()).exists()) {
|
||||
configDirPath = new File(classpathUrl.toURI()).getAbsolutePath();
|
||||
}
|
||||
} catch (URISyntaxException ex) {}
|
||||
configDirPath = getDefaultConfigDirFromClasspath(serverSubPath);
|
||||
}
|
||||
return configDirPath;
|
||||
}
|
||||
|
||||
@SuppressForbidden(reason = "This will be loaded for unit tests, and hence an exception can be made. "
|
||||
+ "In regular server operation, there shouldn't be a situation where we reach this point.")
|
||||
private static String getDefaultConfigDirFromClasspath(String serverSubPath) {
|
||||
URL classpathUrl = Thread.currentThread().getContextClassLoader().getResource(serverSubPath);
|
||||
try {
|
||||
if (classpathUrl != null && new File(classpathUrl.toURI()).exists()) {
|
||||
return new File(classpathUrl.toURI()).getAbsolutePath();
|
||||
}
|
||||
} catch (URISyntaxException ex) {}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void init(CurrentCoreDescriptorProvider registerOnReconnect) {
|
||||
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue