mirror of https://github.com/apache/lucene.git
SOLR-12290,SOLR-12391: Do not close any servlet streams and improve our servlet stream closing prevention code for users and devs.
This commit is contained in:
parent
4888adf08a
commit
1ff24bbb28
|
@ -242,7 +242,7 @@ Bug Fixes
|
|||
non-boolean queries. (James Dyer)
|
||||
|
||||
* SOLR-12290: Do not close any servlet streams and improve our servlet stream closing prevention code for users
|
||||
and devs. (Mark Miller)
|
||||
and devs. (Mark Miller, janhoy, Andrzej Bialecki)
|
||||
|
||||
* SOLR-12293: Updates need to use their own connection pool to maintain connection reuse and prevent spurious
|
||||
recoveries. (Mark Miller)
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.apache.solr.servlet;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.io.output.CloseShieldOutputStream;
|
||||
import org.apache.commons.lang.StringEscapeUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.solr.common.params.CommonParams;
|
||||
|
@ -58,8 +59,8 @@ public final class LoadAdminUiServlet extends BaseSolrServlet {
|
|||
response.setCharacterEncoding("UTF-8");
|
||||
response.setContentType("text/html");
|
||||
|
||||
// Don't close this! - see SOLR-8933
|
||||
out = new OutputStreamWriter(response.getOutputStream(), StandardCharsets.UTF_8);
|
||||
// We have to close this to flush OutputStreamWriter buffer
|
||||
out = new OutputStreamWriter(new CloseShieldOutputStream(response.getOutputStream()), StandardCharsets.UTF_8);
|
||||
|
||||
String html = IOUtils.toString(in, "UTF-8");
|
||||
Package pack = SolrCore.class.getPackage();
|
||||
|
@ -78,6 +79,7 @@ public final class LoadAdminUiServlet extends BaseSolrServlet {
|
|||
out.write( StringUtils.replaceEach(html, search, replace) );
|
||||
} finally {
|
||||
IOUtils.closeQuietly(in);
|
||||
IOUtils.closeQuietly(out);
|
||||
}
|
||||
} else {
|
||||
response.sendError(404);
|
||||
|
|
Loading…
Reference in New Issue