mirror of https://github.com/apache/lucene.git
SOLR-7921: The techproducts example fails when running in a directory that contains spaces.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1695728 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a2ef0a013b
commit
5af08f7211
|
@ -383,6 +383,10 @@ Bug Fixes
|
||||||
* SOLR-7908: SegmentsInfoRequestHandler gets a ref counted IndexWriter and does not properly release it.
|
* SOLR-7908: SegmentsInfoRequestHandler gets a ref counted IndexWriter and does not properly release it.
|
||||||
(Mark Miller, shalin)
|
(Mark Miller, shalin)
|
||||||
|
|
||||||
|
* SOLR-7921: The techproducts example fails when running in a directory that contains spaces.
|
||||||
|
(Ishan Chattopadhyaya via Timothy Potter)
|
||||||
|
|
||||||
|
|
||||||
Optimizations
|
Optimizations
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
|
|
|
@ -2150,17 +2150,9 @@ public class SolrCLI {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exampledocsDir.isDirectory()) {
|
if (exampledocsDir.isDirectory()) {
|
||||||
File postJarFile = new File(exampledocsDir, "post.jar");
|
|
||||||
String updateUrl = String.format(Locale.ROOT, "%s/%s/update", solrUrl, collectionName);
|
String updateUrl = String.format(Locale.ROOT, "%s/%s/update", solrUrl, collectionName);
|
||||||
echo("Indexing tech product example docs from "+exampledocsDir.getAbsolutePath());
|
echo("Indexing tech product example docs from "+exampledocsDir.getAbsolutePath());
|
||||||
if (postJarFile.isFile()) {
|
|
||||||
String javaHome = System.getProperty("java.home");
|
|
||||||
String java = javaHome+"/bin/java";
|
|
||||||
String postCmd = String.format(Locale.ROOT, "%s -Durl=\"%s\" -jar %s \"%s\"/*.xml",
|
|
||||||
java, updateUrl, postJarFile.getAbsolutePath(), exampledocsDir.getAbsolutePath());
|
|
||||||
executor.execute(org.apache.commons.exec.CommandLine.parse(postCmd));
|
|
||||||
} else {
|
|
||||||
// a bit hacky, but just use SimplePostTool directly
|
|
||||||
String currentPropVal = System.getProperty("url");
|
String currentPropVal = System.getProperty("url");
|
||||||
System.setProperty("url", updateUrl);
|
System.setProperty("url", updateUrl);
|
||||||
SimplePostTool.main(new String[] {exampledocsDir.getAbsolutePath()+"/*.xml"});
|
SimplePostTool.main(new String[] {exampledocsDir.getAbsolutePath()+"/*.xml"});
|
||||||
|
@ -2169,7 +2161,6 @@ public class SolrCLI {
|
||||||
} else {
|
} else {
|
||||||
System.clearProperty("url");
|
System.clearProperty("url");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
echo("exampledocs directory not found, skipping indexing step for the techproducts example");
|
echo("exampledocs directory not found, skipping indexing step for the techproducts example");
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,27 +158,6 @@ public class TestSolrCLIRunExample extends SolrTestCaseJ4 {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
String cmdLine = joinArgs(cmd.getArguments());
|
String cmdLine = joinArgs(cmd.getArguments());
|
||||||
if (cmdLine.indexOf("post.jar") != -1) {
|
|
||||||
// invocation of the post.jar file ... we'll just hit the SimplePostTool directly vs. trying to invoke another JVM
|
|
||||||
List<String> argsToSimplePostTool = new ArrayList<String>();
|
|
||||||
boolean afterPostJarArg = false;
|
|
||||||
for (String arg : cmd.getArguments()) {
|
|
||||||
if (arg.startsWith("-D")) {
|
|
||||||
arg = arg.substring(2);
|
|
||||||
int eqPos = arg.indexOf("=");
|
|
||||||
System.setProperty(arg.substring(0,eqPos), arg.substring(eqPos+1));
|
|
||||||
} else {
|
|
||||||
if (arg.endsWith("post.jar")) {
|
|
||||||
afterPostJarArg = true;
|
|
||||||
} else {
|
|
||||||
if (afterPostJarArg) {
|
|
||||||
argsToSimplePostTool.add(arg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SimplePostTool.main(argsToSimplePostTool.toArray(new String[0]));
|
|
||||||
} else {
|
|
||||||
log.info("Executing command: "+cmdLine);
|
log.info("Executing command: "+cmdLine);
|
||||||
try {
|
try {
|
||||||
return super.execute(cmd);
|
return super.execute(cmd);
|
||||||
|
@ -187,7 +166,6 @@ public class TestSolrCLIRunExample extends SolrTestCaseJ4 {
|
||||||
throw exc;
|
throw exc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -301,7 +279,6 @@ public class TestSolrCLIRunExample extends SolrTestCaseJ4 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Ignore
|
|
||||||
@Test
|
@Test
|
||||||
public void testTechproductsExample() throws Exception {
|
public void testTechproductsExample() throws Exception {
|
||||||
testExample("techproducts");
|
testExample("techproducts");
|
||||||
|
|
Loading…
Reference in New Issue