SOLR-2912 -- Fixed File descriptor leak in ShowFileRequestHandler

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1205774 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shalin Shekhar Mangar 2011-11-24 10:11:06 +00:00
parent 1ba08eda03
commit 44fc56dc92
2 changed files with 9 additions and 2 deletions

View File

@ -383,6 +383,10 @@ New Features
* SOLR-1565: StreamingUpdateSolrServer supports RequestWriter API and therefore, javabin update * SOLR-1565: StreamingUpdateSolrServer supports RequestWriter API and therefore, javabin update
format (shalin) format (shalin)
Bug Fixes
----------------------
* SOLR-2912: Fixed File descriptor leak in ShowFileRequestHandler (Michael Ryan, shalin)
================== 3.5.0 ================== ================== 3.5.0 ==================
New Features New Features

View File

@ -206,11 +206,14 @@ public class ShowFileRequestHandler extends RequestHandlerBase
return ""; // ignore it... return ""; // ignore it...
} }
} }
InputStream input = null;
try { try {
InputStream input = core.getResourceLoader().openResource(path); input = core.getResourceLoader().openResource(path);
return IOUtils.toString( input, "UTF-8" ); return IOUtils.toString( input, "UTF-8" );
} catch( Exception ex ) {
} finally {
IOUtils.closeQuietly(input);
} }
catch( Exception ex ) {} // ignore it
return ""; return "";
} }