SOLR-11879: avoid EOFException when content is send without a payload

This commit is contained in:
Noble Paul 2018-01-29 21:41:22 +11:00
parent 27ef653064
commit 586aa65110
1 changed files with 8 additions and 7 deletions

View File

@ -16,6 +16,13 @@
*/ */
package org.apache.solr.handler.loader; package org.apache.solr.handler.loader;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.apache.solr.client.solrj.request.JavaBinUpdateRequestCodec; import org.apache.solr.client.solrj.request.JavaBinUpdateRequestCodec;
import org.apache.solr.client.solrj.request.UpdateRequest; import org.apache.solr.client.solrj.request.UpdateRequest;
import org.apache.solr.common.SolrException; import org.apache.solr.common.SolrException;
@ -32,13 +39,6 @@ import org.apache.solr.update.AddUpdateCommand;
import org.apache.solr.update.DeleteUpdateCommand; import org.apache.solr.update.DeleteUpdateCommand;
import org.apache.solr.update.processor.UpdateRequestProcessor; import org.apache.solr.update.processor.UpdateRequestProcessor;
import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
/** /**
* Update handler which uses the JavaBin format * Update handler which uses the JavaBin format
* *
@ -103,6 +103,7 @@ public class JavabinLoader extends ContentStreamLoader {
} }
}; };
FastInputStream in = FastInputStream.wrap(stream); FastInputStream in = FastInputStream.wrap(stream);
if (in.peek() == -1) return;
for (; ; ) { for (; ; ) {
try { try {
update = new JavaBinUpdateRequestCodec().unmarshal(in, handler); update = new JavaBinUpdateRequestCodec().unmarshal(in, handler);