thomaswoeckinger commented on a change in pull request #665: Fixes SOLR-13539
URL: https://github.com/apache/lucene-solr/pull/665#discussion_r296183083
##########
File path:
solr/solrj/src/java/org/apache/solr/client/solrj/util/ClientUtils.java
##########
@@ -104,35 +103,51 @@ public static void writeXML( SolrInputDocument doc,
Writer writer ) throws IOExc
writer.write("</doc>");
}
- private static void writeVal(Writer writer, String name, Object v, String
update) throws IOException {
+ private static void writeVal(Writer writer, String name, Object v, String
update)
+ throws IOException {
+ boolean binary = false;
if (v instanceof Date) {
- v = ((Date)v).toInstant().toString();
+ v = ((Date) v).toInstant().toString();
} else if (v instanceof byte[]) {
byte[] bytes = (byte[]) v;
v = Base64.byteArrayToBase64(bytes, 0, bytes.length);
+ binary = true;
} else if (v instanceof ByteBuffer) {
ByteBuffer bytes = (ByteBuffer) v;
- v = Base64.byteArrayToBase64(bytes.array(),
bytes.position(),bytes.limit() - bytes.position());
+ v = Base64.byteArrayToBase64(bytes.array(), bytes.position(),
bytes.limit() - bytes.position());
+ binary = true;
}
XML.Writable valWriter = null;
- if(v instanceof SolrInputDocument) {
+ if (v instanceof SolrInputDocument) {
final SolrInputDocument solrDoc = (SolrInputDocument) v;
valWriter = (writer1) -> writeXML(solrDoc, writer1);
- } else if(v != null) {
- final Object val = v;
- valWriter = (writer1) -> XML.escapeCharData(val.toString(), writer1);
+ } else if (v != null) {
+ Object val = v;
+ if (binary) {
+ valWriter = (writer1) -> writer1.write((String) val);
+ } else {
+ valWriter = (writer1) -> XML.escapeCharData(val.toString(), writer1);
+ }
}
if (update == null) {
if (v != null) {
- XML.writeXML(writer, "field", valWriter, "name", name);
+ if (binary) {
+ XML.writeXML(writer, "field", valWriter, "name", name, "dt",
XMLLoader.BINARY_BASE64);
Review comment:
This a result of the single project creation for eclipse, it is nearly
impossible to see which one is depending on what ever, it is all in the same
classpath, anyway i will take a look and push again
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]