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.
|
||||
(Mark Miller, shalin)
|
||||
|
||||
* SOLR-7921: The techproducts example fails when running in a directory that contains spaces.
|
||||
(Ishan Chattopadhyaya via Timothy Potter)
|
||||
|
||||
|
||||
Optimizations
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -2150,25 +2150,16 @@ public class SolrCLI {
|
|||
}
|
||||
|
||||
if (exampledocsDir.isDirectory()) {
|
||||
File postJarFile = new File(exampledocsDir, "post.jar");
|
||||
String updateUrl = String.format(Locale.ROOT, "%s/%s/update", solrUrl, collectionName);
|
||||
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));
|
||||
|
||||
String currentPropVal = System.getProperty("url");
|
||||
System.setProperty("url", updateUrl);
|
||||
SimplePostTool.main(new String[] {exampledocsDir.getAbsolutePath()+"/*.xml"});
|
||||
if (currentPropVal != null) {
|
||||
System.setProperty("url", currentPropVal); // reset
|
||||
} else {
|
||||
// a bit hacky, but just use SimplePostTool directly
|
||||
String currentPropVal = System.getProperty("url");
|
||||
System.setProperty("url", updateUrl);
|
||||
SimplePostTool.main(new String[] {exampledocsDir.getAbsolutePath()+"/*.xml"});
|
||||
if (currentPropVal != null) {
|
||||
System.setProperty("url", currentPropVal); // reset
|
||||
} else {
|
||||
System.clearProperty("url");
|
||||
}
|
||||
System.clearProperty("url");
|
||||
}
|
||||
} else {
|
||||
echo("exampledocs directory not found, skipping indexing step for the techproducts example");
|
||||
|
|
|
@ -158,34 +158,12 @@ public class TestSolrCLIRunExample extends SolrTestCaseJ4 {
|
|||
}
|
||||
} else {
|
||||
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);
|
||||
try {
|
||||
return super.execute(cmd);
|
||||
} catch (Exception exc) {
|
||||
log.error("Execute command ["+cmdLine+"] failed due to: "+exc, exc);
|
||||
throw exc;
|
||||
}
|
||||
log.info("Executing command: "+cmdLine);
|
||||
try {
|
||||
return super.execute(cmd);
|
||||
} catch (Exception exc) {
|
||||
log.error("Execute command ["+cmdLine+"] failed due to: "+exc, exc);
|
||||
throw exc;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -301,7 +279,6 @@ public class TestSolrCLIRunExample extends SolrTestCaseJ4 {
|
|||
}
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void testTechproductsExample() throws Exception {
|
||||
testExample("techproducts");
|
||||
|
|
Loading…
Reference in New Issue