SOLR-9147: using BAOS from commons io 2.5 in EmbeddedSolrServer to avoid array resize.

This commit is contained in:
Mikhail Khludnev 2016-05-21 23:11:41 +03:00
parent b922033517
commit 3ea12f2be4
8 changed files with 10 additions and 9 deletions

View File

@ -64,7 +64,7 @@ com.sun.jersey.version = 1.9
/commons-configuration/commons-configuration = 1.6
/commons-digester/commons-digester = 2.1
/commons-fileupload/commons-fileupload = 1.3.1
/commons-io/commons-io = 2.4
/commons-io/commons-io = 2.5
/commons-lang/commons-lang = 2.6
/commons-logging/commons-logging = 1.1.3
/de.l3s.boilerpipe/boilerpipe = 1.1.0

View File

@ -316,6 +316,8 @@ Other Changes
* SOLR-9131: Fix "start solr" text in cluster.vm Velocity template (janhoy)
* SOLR-9147: Upgrade commons-io to 2.5, avoid expensive array resizing in EmbeddedSolrServer (Mikhail Khludnev)
================== 6.0.1 ==================
(No Changes)

View File

@ -510,7 +510,6 @@
<!-- TODO: fix this in forbiddenapis 2.1+ -->
<bundled name="jdk-unsafe-1.${javac.release}"/>
<bundled name="jdk-deprecated-1.${javac.release}"/>
<bundled name="commons-io-unsafe-${ivyversions./commons-io/commons-io}"/>
<fileset dir="${common.dir}/tools/forbiddenApis">
<include name="base.txt" />
<include name="servlet-api.txt" />

View File

@ -31,6 +31,7 @@
<dependencies>
<dependency org="commons-codec" name="commons-codec" rev="${/commons-codec/commons-codec}" conf="compile"/>
<dependency org="commons-io" name="commons-io" rev="${/commons-io/commons-io}" conf="compile"/>
<dependency org="org.apache.commons" name="commons-exec" rev="${/org.apache.commons/commons-exec}" conf="compile"/>
<dependency org="commons-fileupload" name="commons-fileupload" rev="${/commons-fileupload/commons-fileupload}" conf="compile"/>
<dependency org="commons-cli" name="commons-cli" rev="${/commons-cli/commons-cli}" conf="compile"/>

View File

@ -16,13 +16,13 @@
*/
package org.apache.solr.client.solrj.embedded;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Path;
import com.google.common.base.Strings;
import org.apache.commons.io.output.ByteArrayOutputStream;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrRequest;
import org.apache.solr.client.solrj.SolrServerException;
@ -223,7 +223,7 @@ public class EmbeddedSolrServer extends SolrClient {
}.setWritableDocFields(resolver). marshal(rsp.getValues(), out);
InputStream in = new ByteArrayInputStream(out.toByteArray());
InputStream in = out.toInputStream();
return (NamedList<Object>) new JavaBinCodec(resolver).unmarshal(in);
} catch (Exception ex) {
throw new RuntimeException(ex);

View File

@ -16,8 +16,6 @@
*/
package org.apache.solr.response;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -27,6 +25,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.apache.commons.io.output.ByteArrayOutputStream;
import org.apache.lucene.index.IndexableField;
import org.apache.solr.client.solrj.impl.BinaryResponseParser;
import org.apache.solr.common.SolrDocument;
@ -165,7 +164,7 @@ public class BinaryResponseWriter implements BinaryQueryResponseWriter {
ByteArrayOutputStream out = new ByteArrayOutputStream();
new JavaBinCodec(resolver).setWritableDocFields(resolver).marshal(rsp.getValues(), out);
InputStream in = new ByteArrayInputStream(out.toByteArray());
InputStream in = out.toInputStream();
return (NamedList<Object>) new JavaBinCodec(resolver).unmarshal(in);
}
catch (Exception ex) {

View File

@ -1 +0,0 @@
b1b6ea3b7e4aa4f492509a4952029cd8e48019ad

View File

@ -0,0 +1 @@
2852e6e05fbb95076fc091f6d1780f1f8fe35e0f