diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BinaryRequestWriter.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BinaryRequestWriter.java index 1f32e073929..ee961ef553a 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BinaryRequestWriter.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BinaryRequestWriter.java @@ -40,12 +40,7 @@ public class BinaryRequestWriter extends RequestWriter { public ContentWriter getContentWriter(SolrRequest req) { if (req instanceof UpdateRequest) { UpdateRequest updateRequest = (UpdateRequest) req; - if (isNull(updateRequest.getDocuments()) && - isNull(updateRequest.getDeleteByIdMap()) && - isNull(updateRequest.getDeleteQuery()) - && (updateRequest.getDocIterator() == null)) { - return null; - } + if (isEmpty(updateRequest)) return null; return new ContentWriter() { @Override public void write(OutputStream os) throws IOException { @@ -66,12 +61,7 @@ public class BinaryRequestWriter extends RequestWriter { public Collection getContentStreams(SolrRequest req) throws IOException { if (req instanceof UpdateRequest) { UpdateRequest updateRequest = (UpdateRequest) req; - if (isNull(updateRequest.getDocuments()) && - isNull(updateRequest.getDeleteByIdMap()) && - isNull(updateRequest.getDeleteQuery()) - && (updateRequest.getDocIterator() == null) ) { - return null; - } + if (isEmpty(updateRequest) ) return null; throw new RuntimeException("This Should not happen"); } else { return super.getContentStreams(req); diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/request/RequestWriter.java b/solr/solrj/src/java/org/apache/solr/client/solrj/request/RequestWriter.java index 8cefa0b303d..d83ca911ee2 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/request/RequestWriter.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/request/RequestWriter.java @@ -73,7 +73,7 @@ public class RequestWriter { return req.getContentStreams(); } - private boolean isEmpty(UpdateRequest updateRequest) { + protected boolean isEmpty(UpdateRequest updateRequest) { return isNull(updateRequest.getDocuments()) && isNull(updateRequest.getDeleteByIdMap()) && isNull(updateRequest.getDeleteQuery()) &&