Skip to content

Commit

Permalink
SOLR-17629: SQLHandler: remember to close if open fails
Browse files Browse the repository at this point in the history
  • Loading branch information
dsmiley committed Jan 18, 2025
1 parent af5fea7 commit ab03362
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions solr/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ Bug Fixes
doing distributed search (sharded collections). This could likely occur for fielded parameters such as
f.CASE_SENSITIVE_FIELD.facet.limit=50. (Yue Yu, David Smiley)

* SOLR-17629: If SQLHandler failed to open the underlying stream (e.g. Solr returns an error; could be user/syntax problem),
it needs to close the stream to cleanup resources but wasn't. (David Smiley)

Dependency Upgrades
---------------------
* SOLR-17471: Upgrade Lucene to 9.12.1. (Pierre Salagnac, Christine Poerschke)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.apache.calcite.linq4j.Enumerator;
import org.apache.solr.client.solrj.io.Tuple;
import org.apache.solr.client.solrj.io.stream.TupleStream;
import org.apache.solr.common.util.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -42,11 +43,11 @@ class SolrEnumerator implements Enumerator<Object> {
* @param fields Fields to get from each Tuple
*/
SolrEnumerator(TupleStream tupleStream, List<Map.Entry<String, Class<?>>> fields) {

this.tupleStream = tupleStream;
try {
this.tupleStream.open();
} catch (IOException e) {
IOUtils.closeQuietly(tupleStream);
throw new RuntimeException(e);
}
this.fields = fields;
Expand Down

0 comments on commit ab03362

Please sign in to comment.