lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yo...@apache.org
Subject svn commit: r1026074 - in /lucene/solr/branches/branch-1.4: CHANGES.txt src/webapp/src/org/apache/solr/client/solrj/embedded/EmbeddedSolrServer.java
Date Thu, 21 Oct 2010 17:14:37 GMT
Author: yonik
Date: Thu Oct 21 17:14:36 2010
New Revision: 1026074

URL: http://svn.apache.org/viewvc?rev=1026074&view=rev
Log:
SOLR-2180: close request in finally block

Modified:
    lucene/solr/branches/branch-1.4/CHANGES.txt
    lucene/solr/branches/branch-1.4/src/webapp/src/org/apache/solr/client/solrj/embedded/EmbeddedSolrServer.java

Modified: lucene/solr/branches/branch-1.4/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/solr/branches/branch-1.4/CHANGES.txt?rev=1026074&r1=1026073&r2=1026074&view=diff
==============================================================================
--- lucene/solr/branches/branch-1.4/CHANGES.txt (original)
+++ lucene/solr/branches/branch-1.4/CHANGES.txt Thu Oct 21 17:14:36 2010
@@ -59,6 +59,9 @@ Bug Fixes
   to be removed before it was finished being copied.  This did not affect
   normal master/slave replication.  (Peter Sturge via yonik)
 
+* SOLR-2180: It was possible for EmbeddedSolrServer to leave searchers
+  open if a request threw an exception. (yonik)
+
 
 ================== Release 1.4.1 ==================
 Release Date:  See http://lucene.apache.org/solr for the official release date.

Modified: lucene/solr/branches/branch-1.4/src/webapp/src/org/apache/solr/client/solrj/embedded/EmbeddedSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/branch-1.4/src/webapp/src/org/apache/solr/client/solrj/embedded/EmbeddedSolrServer.java?rev=1026074&r1=1026073&r2=1026074&view=diff
==============================================================================
--- lucene/solr/branches/branch-1.4/src/webapp/src/org/apache/solr/client/solrj/embedded/EmbeddedSolrServer.java
(original)
+++ lucene/solr/branches/branch-1.4/src/webapp/src/org/apache/solr/client/solrj/embedded/EmbeddedSolrServer.java
Thu Oct 21 17:14:36 2010
@@ -132,8 +132,9 @@ public class EmbeddedSolrServer extends 
       throw new SolrException( SolrException.ErrorCode.BAD_REQUEST, "unknown handler: "+path
);
     }
 
+    SolrQueryRequest req = null;
     try {
-      SolrQueryRequest req = _parser.buildRequestFrom( core, params, request.getContentStreams()
);
+      req = _parser.buildRequestFrom( core, params, request.getContentStreams() );
       req.getContext().put( "path", path );
       SolrQueryResponse rsp = new SolrQueryResponse();
       core.execute( handler, req, rsp );
@@ -143,7 +144,6 @@ public class EmbeddedSolrServer extends 
       
       // Now write it out
       NamedList<Object> normalized = getParsedResponse(req, rsp);
-      req.close();
       return normalized;
     }
     catch( IOException iox ) {
@@ -153,7 +153,11 @@ public class EmbeddedSolrServer extends 
       throw new SolrServerException( ex );
     }
     finally {
-      core.close();
+      try {
+        if (req != null) req.close();
+      } finally {
+        core.close();
+      }
     }
   }
   



Mime
View raw message