SOLR-1301: Fix windows problem with escaping of folder name (see crazy https://github.com/typesafehub/config/blob/master/HOCON.md for correct format: string must be quoted and escaped like javascript)

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1547239 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2013-12-02 23:30:54 +00:00
parent b7911212bf
commit ae33505da5
2 changed files with 3 additions and 2 deletions

View File

@ -28,6 +28,7 @@ import java.util.Map.Entry;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.SolrTestCaseJ4;
import org.apache.solr.client.solrj.SolrQuery; import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.SolrServer; import org.apache.solr.client.solrj.SolrServer;
@ -182,7 +183,7 @@ public class AbstractSolrMorphlineTestBase extends SolrTestCaseJ4 {
public static void setupMorphline(String tempDir, String file) throws IOException { public static void setupMorphline(String tempDir, String file) throws IOException {
String morphlineText = FileUtils.readFileToString(new File(RESOURCES_DIR + "/" + file + ".conf"), "UTF-8"); String morphlineText = FileUtils.readFileToString(new File(RESOURCES_DIR + "/" + file + ".conf"), "UTF-8");
morphlineText = morphlineText.replaceAll("RESOURCES_DIR", new File(tempDir).getAbsolutePath()); morphlineText = morphlineText.replace("RESOURCES_DIR", StringEscapeUtils.escapeJavaScript(new File(tempDir).getAbsolutePath()));
FileUtils.writeStringToFile(new File(tempDir + "/" + file + ".conf"), morphlineText, "UTF-8"); FileUtils.writeStringToFile(new File(tempDir + "/" + file + ".conf"), morphlineText, "UTF-8");
} }

View File

@ -52,7 +52,7 @@ morphlines : [
# used for auto-detection if MIME type isn't explicitly supplied # used for auto-detection if MIME type isn't explicitly supplied
detectMimeType { detectMimeType {
includeDefaultMimeTypes : true includeDefaultMimeTypes : true
mimeTypesFiles : [RESOURCES_DIR/custom-mimetypes.xml] mimeTypesFiles : ["RESOURCES_DIR/custom-mimetypes.xml"]
} }
} }