mirror of https://github.com/apache/lucene.git
SOLR-2127: Fixed serialization of default core and indentation of solr.xml when serializing.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1062319 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
741882bcb1
commit
22f0fe9718
|
@ -158,6 +158,8 @@ Bug Fixes
|
|||
dealing with SolrDocumentList objects -- ie: sharded queries.
|
||||
(Antonio Verni via hossman)
|
||||
|
||||
* SOLR-2127: Fixed serialization of default core and indentation of solr.xml when serializing.
|
||||
(Ephraim Ofir, Mark Miller)
|
||||
|
||||
Other Changes
|
||||
----------------------
|
||||
|
|
|
@ -879,7 +879,7 @@ public class CoreContainer
|
|||
|
||||
/** Write the cores configuration through a writer.*/
|
||||
void persist(Writer w) throws IOException {
|
||||
w.write("<?xml version='1.0' encoding='UTF-8'?>");
|
||||
w.write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
|
||||
w.write("<solr");
|
||||
if (this.libDir != null) {
|
||||
writeAttribute(w,"sharedLib",libDir);
|
||||
|
@ -888,9 +888,9 @@ public class CoreContainer
|
|||
w.write(">\n");
|
||||
|
||||
if (containerProperties != null && !containerProperties.isEmpty()) {
|
||||
writeProperties(w, containerProperties);
|
||||
writeProperties(w, containerProperties, " ");
|
||||
}
|
||||
w.write("<cores");
|
||||
w.write(" <cores");
|
||||
writeAttribute(w, "adminPath",adminPath);
|
||||
if(adminHandler != null) writeAttribute(w, "adminHandler",adminHandler);
|
||||
if(shareSchema) writeAttribute(w, "shareSchema","true");
|
||||
|
@ -903,7 +903,7 @@ public class CoreContainer
|
|||
}
|
||||
}
|
||||
|
||||
w.write("</cores>\n");
|
||||
w.write(" </cores>\n");
|
||||
w.write("</solr>\n");
|
||||
}
|
||||
|
||||
|
@ -919,7 +919,7 @@ public class CoreContainer
|
|||
/** Writes the cores configuration node for a given core. */
|
||||
void persist(Writer w, CoreDescriptor dcore) throws IOException {
|
||||
w.write(" <core");
|
||||
writeAttribute(w,"name",dcore.name);
|
||||
writeAttribute(w,"name",dcore.name.equals("") ? defaultCoreName : dcore.name);
|
||||
writeAttribute(w,"instanceDir",dcore.getInstanceDir());
|
||||
//write config (if not default)
|
||||
String opt = dcore.getConfigName();
|
||||
|
@ -953,14 +953,14 @@ public class CoreContainer
|
|||
w.write("/>\n"); // core
|
||||
else {
|
||||
w.write(">\n");
|
||||
writeProperties(w, dcore.getCoreProperties());
|
||||
w.write("</core>");
|
||||
writeProperties(w, dcore.getCoreProperties(), " ");
|
||||
w.write(" </core>\n");
|
||||
}
|
||||
}
|
||||
|
||||
private void writeProperties(Writer w, Properties props) throws IOException {
|
||||
private void writeProperties(Writer w, Properties props, String indent) throws IOException {
|
||||
for (Map.Entry<Object, Object> entry : props.entrySet()) {
|
||||
w.write("<property");
|
||||
w.write(indent + "<property");
|
||||
writeAttribute(w,"name",entry.getKey());
|
||||
writeAttribute(w,"value",entry.getValue());
|
||||
w.write("/>\n");
|
||||
|
|
Loading…
Reference in New Issue