From c446aec1ed5f22809bf54ff5a9fbf415d423de3d Mon Sep 17 00:00:00 2001 From: Shalin Shekhar Mangar Date: Sun, 16 Mar 2014 14:46:02 +0000 Subject: [PATCH] SOLR-5838: Relative SolrHome Path Bug At AbstractFullDistribZkTestBase git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1578089 13f79535-47bb-0310-9956-ffa450edef68 --- solr/CHANGES.txt | 3 +++ .../solr/cloud/AbstractFullDistribZkTestBase.java | 11 ++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index ac5c0e9dee0..acdce1d7aa4 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -238,6 +238,9 @@ Other Changes * SOLR-5853: The createCollection methods in the test framework now reports result of operation in the returned CollectionAdminResponse (janhoy) +* SOLR-5838: Relative SolrHome Path Bug At AbstractFullDistribZkTestBase. + (Furkan KAMACI via shalin) + ================== 4.7.0 ================== Versions of Major Components diff --git a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java index e5f66c6ed66..e525926271c 100644 --- a/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java +++ b/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java @@ -496,9 +496,10 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes String path = SolrResourceLoader.normalizeDir(new File(".").getAbsolutePath()); String base = new File(solrHome.getPath()).getAbsolutePath(); - if (base.startsWith(".")); - base.replaceFirst("\\.", new File(".").getName()); - + if (base.startsWith(".")) { + base = base.replaceFirst("\\.", new File(".").getName()); + } + if (path.endsWith(File.separator + ".")) { path = path.substring(0, path.length() - 2); } @@ -507,7 +508,7 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes StringBuilder p = new StringBuilder(); for (int i = 0; i < splits - 2; i++) { - p.append(".." + File.separator); + p.append("..").append(File.separator); } String prefix = FilenameUtils.getPrefix(path); @@ -1823,4 +1824,4 @@ public abstract class AbstractFullDistribZkTestBase extends AbstractDistribZkTes fail("Could not find the new collection - " + exp.code() + " : " + collectionClient.getBaseURL()); } -} \ No newline at end of file +}