lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject lucene-solr:master: SOLR-12290, SOLR-12391: Do not close any servlet streams and improve our servlet stream closing prevention code for users and devs.
Date Sat, 02 Jun 2018 05:19:43 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/master 4888adf08 -> 1ff24bbb2


SOLR-12290,SOLR-12391: Do not close any servlet streams and improve our servlet stream closing
prevention code for users and devs.


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

Branch: refs/heads/master
Commit: 1ff24bbb283a4cbfb9a6babfa702fbd57804a7fd
Parents: 4888adf
Author: markrmiller <markrmiller@apache.org>
Authored: Sat Jun 2 00:16:28 2018 -0500
Committer: markrmiller <markrmiller@apache.org>
Committed: Sat Jun 2 00:16:28 2018 -0500

----------------------------------------------------------------------
 solr/CHANGES.txt                                               | 2 +-
 .../src/java/org/apache/solr/servlet/LoadAdminUiServlet.java   | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1ff24bbb/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 80f21a5..66d8853 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -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)

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/1ff24bbb/solr/core/src/java/org/apache/solr/servlet/LoadAdminUiServlet.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/servlet/LoadAdminUiServlet.java b/solr/core/src/java/org/apache/solr/servlet/LoadAdminUiServlet.java
index 1aa1137..f5c301e 100644
--- a/solr/core/src/java/org/apache/solr/servlet/LoadAdminUiServlet.java
+++ b/solr/core/src/java/org/apache/solr/servlet/LoadAdminUiServlet.java
@@ -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);


Mime
View raw message