lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject [45/50] [abbrv] lucene-solr:jira/solr-11285-sim: SOLR-11380: use the inNull() method to check for empty UpdateRequest
Date Tue, 31 Oct 2017 14:02:27 GMT
SOLR-11380: use the inNull() method to check for empty UpdateRequest


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/cb3ed762
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/cb3ed762
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/cb3ed762

Branch: refs/heads/jira/solr-11285-sim
Commit: cb3ed762fb418ff2af43b520cbe233cf74bccdd1
Parents: 706b6c9
Author: Noble Paul <noble@apache.org>
Authored: Tue Oct 31 16:33:08 2017 +1030
Committer: Noble Paul <noble@apache.org>
Committed: Tue Oct 31 16:34:00 2017 +1030

----------------------------------------------------------------------
 .../solr/client/solrj/impl/BinaryRequestWriter.java   | 14 ++------------
 .../solr/client/solrj/request/RequestWriter.java      |  2 +-
 2 files changed, 3 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/cb3ed762/solr/solrj/src/java/org/apache/solr/client/solrj/impl/BinaryRequestWriter.java
----------------------------------------------------------------------
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 1f32e07..ee961ef 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<ContentStream> 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);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/cb3ed762/solr/solrj/src/java/org/apache/solr/client/solrj/request/RequestWriter.java
----------------------------------------------------------------------
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 8cefa0b..d83ca91 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()) &&


Mime
View raw message