diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index ef3068ae005..c0906688f9b 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -383,6 +383,10 @@ New Features * SOLR-1565: StreamingUpdateSolrServer supports RequestWriter API and therefore, javabin update format (shalin) +Bug Fixes +---------------------- +* SOLR-2912: Fixed File descriptor leak in ShowFileRequestHandler (Michael Ryan, shalin) + ================== 3.5.0 ================== New Features diff --git a/solr/core/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java index d2e76ddf607..4869483927a 100644 --- a/solr/core/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java +++ b/solr/core/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java @@ -206,11 +206,14 @@ public class ShowFileRequestHandler extends RequestHandlerBase return ""; // ignore it... } } + InputStream input = null; try { - InputStream input = core.getResourceLoader().openResource(path); + input = core.getResourceLoader().openResource(path); return IOUtils.toString( input, "UTF-8" ); + } catch( Exception ex ) { + } finally { + IOUtils.closeQuietly(input); } - catch( Exception ex ) {} // ignore it return ""; }