lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yo...@apache.org
Subject svn commit: r632541 - /lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/DirectSolrConnection.java
Date Sat, 01 Mar 2008 02:53:10 GMT
Author: yonik
Date: Fri Feb 29 18:53:09 2008
New Revision: 632541

URL: http://svn.apache.org/viewvc?rev=632541&view=rev
Log:
close request in DirectSolrConnection

Modified:
    lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/DirectSolrConnection.java

Modified: lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/DirectSolrConnection.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/DirectSolrConnection.java?rev=632541&r1=632540&r2=632541&view=diff
==============================================================================
--- lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/DirectSolrConnection.java (original)
+++ lucene/solr/trunk/src/webapp/src/org/apache/solr/servlet/DirectSolrConnection.java Fri
Feb 29 18:53:09 2008
@@ -157,18 +157,25 @@
       streams.add( new ContentStreamBase.StringStream( body ) );
     }
     
-    SolrQueryRequest req = parser.buildRequestFrom( core, params, streams );
-    SolrQueryResponse rsp = new SolrQueryResponse();
-    core.execute( handler, req, rsp );
-    if( rsp.getException() != null ) {
-      throw rsp.getException();
+    SolrQueryRequest req = null;
+    try {
+      req = parser.buildRequestFrom( core, params, streams );
+      SolrQueryResponse rsp = new SolrQueryResponse();
+      core.execute( handler, req, rsp );
+      if( rsp.getException() != null ) {
+        throw rsp.getException();
+      }
+      
+      // Now write it out
+      QueryResponseWriter responseWriter = core.getQueryResponseWriter(req);
+      StringWriter out = new StringWriter();
+      responseWriter.write(out, req, rsp);
+      return out.toString();
+    } finally {
+      if (req != null) {
+        req.close();
+      }
     }
-    
-    // Now write it out
-    QueryResponseWriter responseWriter = core.getQueryResponseWriter(req);
-    StringWriter out = new StringWriter();
-    responseWriter.write(out, req, rsp);
-    return out.toString();
   }
   
   /**



Mime
View raw message