You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2013/01/16 20:57:16 UTC

svn commit: r1434355 - in /lucene/dev/branches/lucene_solr_4_1: ./ solr/ solr/CHANGES.txt solr/solrj/ solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java

Author: markrmiller
Date: Wed Jan 16 19:57:15 2013
New Revision: 1434355

URL: http://svn.apache.org/viewvc?rev=1434355&view=rev
Log:
SOLR-4266: HttpSolrServer does not release connection properly on exception when no response parser is used.

Modified:
    lucene/dev/branches/lucene_solr_4_1/   (props changed)
    lucene/dev/branches/lucene_solr_4_1/solr/   (props changed)
    lucene/dev/branches/lucene_solr_4_1/solr/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/lucene_solr_4_1/solr/solrj/   (props changed)
    lucene/dev/branches/lucene_solr_4_1/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java

Modified: lucene/dev/branches/lucene_solr_4_1/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_4_1/solr/CHANGES.txt?rev=1434355&r1=1434354&r2=1434355&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_4_1/solr/CHANGES.txt (original)
+++ lucene/dev/branches/lucene_solr_4_1/solr/CHANGES.txt Wed Jan 16 19:57:15 2013
@@ -516,6 +516,9 @@ Bug Fixes
 
 * SOLR-4303: On replication, if the generation of the master is lower than the
   slave we need to force a full copy of the index. (Mark Miller, Gregg Donovan)
+  
+* SOLR-4266: HttpSolrServer does not release connection properly on exception
+  when no response parser is used. (Steve Molloy via Mark Miller)
 
 Other Changes
 ----------------------

Modified: lucene/dev/branches/lucene_solr_4_1/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene_solr_4_1/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java?rev=1434355&r1=1434354&r2=1434355&view=diff
==============================================================================
--- lucene/dev/branches/lucene_solr_4_1/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java (original)
+++ lucene/dev/branches/lucene_solr_4_1/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java Wed Jan 16 19:57:15 2013
@@ -346,6 +346,7 @@ public class HttpSolrServer extends Solr
     method.addHeader("User-Agent", AGENT);
     
     InputStream respBody = null;
+    boolean shouldClose = true;
     
     try {
       // Execute the method.
@@ -378,6 +379,8 @@ public class HttpSolrServer extends Solr
         // no processor specified, return raw stream
         NamedList<Object> rsp = new NamedList<Object>();
         rsp.add("stream", respBody);
+        // Only case where stream should not be closed
+        shouldClose = false;
         return rsp;
       }
       String charset = EntityUtils.getContentCharSet(response.getEntity());
@@ -413,7 +416,7 @@ public class HttpSolrServer extends Solr
       throw new SolrServerException(
           "IOException occured when talking to server at: " + getBaseURL(), e);
     } finally {
-      if (respBody != null && processor!=null) {
+      if (respBody != null && shouldClose) {
         try {
           respBody.close();
         } catch (Throwable t) {} // ignore