You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by no...@apache.org on 2019/09/03 02:45:39 UTC

[lucene-solr] branch jira/SOLR-13731 updated: formatting

This is an automated email from the ASF dual-hosted git repository.

noble pushed a commit to branch jira/SOLR-13731
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/jira/SOLR-13731 by this push:
     new aef7321  formatting
aef7321 is described below

commit aef7321bb7dd25eb2d93dc4ad4c95a3b3668b8cf
Author: noble <no...@apache.org>
AuthorDate: Tue Sep 3 12:45:12 2019 +1000

    formatting
---
 .../solrj/request/JavaBinUpdateRequestCodec.java     | 20 ++------------------
 .../java/org/apache/solr/common/util/NamedList.java  |  1 +
 .../client/solrj/request/TestUpdateRequestCodec.java |  1 +
 3 files changed, 4 insertions(+), 18 deletions(-)

diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/request/JavaBinUpdateRequestCodec.java b/solr/solrj/src/java/org/apache/solr/client/solrj/request/JavaBinUpdateRequestCodec.java
index 961cbe0..352f4ff 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/request/JavaBinUpdateRequestCodec.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/request/JavaBinUpdateRequestCodec.java
@@ -218,15 +218,6 @@ public class JavaBinUpdateRequestCodec {
     }
 
     @Override
-    public Object unmarshal(InputStream is) throws IOException {
-      try {
-        return super.unmarshal(is);
-      } finally {
-        if (namedList[0] == null) namedList[0] = new NamedList();
-      }
-    }
-
-    @Override
     protected SolrInputDocument createSolrInputDocument(int sz) {
       return new MaskCharSequenceSolrInputDoc(sz == -1 ? new LinkedHashMap<>() : new LinkedHashMap(sz));
     }
@@ -290,11 +281,9 @@ public class JavaBinUpdateRequestCodec {
 
 
     private List readOuterMostDocIterator(DataInputInputStream fis) throws IOException {
+      if (this.namedList[0] == null) this.namedList[0] = new NamedList();
       NamedList namedList = this.namedList[0];
-      NamedList params = null;
-      if(namedList != null) {
-        params = (NamedList) namedList.get("params");
-      }
+      NamedList params = (NamedList) namedList.get("params");
       if(params == null) params = new NamedList();
       updateRequest.setParams(new ModifiableSolrParams(params.toSolrParams()));
       if (handler == null) return super.readIterator(fis);
@@ -348,11 +337,6 @@ public class JavaBinUpdateRequestCodec {
       }
     }
 
-    @Override
-    protected Map newMap(int size) {
-      return new NamedList<>().asShallowMap(true);
-    }
-
     private SolrInputDocument convertMapToSolrInputDoc(Map m) {
       SolrInputDocument result = createSolrInputDocument(m.size());
       m.forEach((k, v) -> {
diff --git a/solr/solrj/src/java/org/apache/solr/common/util/NamedList.java b/solr/solrj/src/java/org/apache/solr/common/util/NamedList.java
index a853c43..fff18d5 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/NamedList.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/NamedList.java
@@ -449,6 +449,7 @@ public class NamedList<T> implements Cloneable, Serializable, Iterable<Map.Entry
       public T put(String  key, T value) {
         if(allowDps){
           NamedList.this.add(key, value);
+          return null;
         }
         int idx = NamedList.this.indexOf(key, 0);
         if (idx == -1) {
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestUpdateRequestCodec.java b/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestUpdateRequestCodec.java
index e316972..e5f2cce 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestUpdateRequestCodec.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestUpdateRequestCodec.java
@@ -156,6 +156,7 @@ public class TestUpdateRequestCodec extends SolrTestCase {
 
   }
 
+  //this format accepts a 1:1 mapping of the json format and javabin format
   public void testStreamableInputDocFormat() throws IOException {
     Map m = Utils.makeMap("id","1","desc" ,"The desc 1");
     m.put(CHILDDOC, (MapWriter) ew -> {