mirror of https://github.com/apache/lucene.git
SOLR-869 -- Fix file descriptor leak in SolrResourceLoader#getLines
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@718941 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
993c2dbb98
commit
8f14ef8475
|
@ -121,6 +121,8 @@ Bug Fixes
|
|||
|
||||
9. SOLR-803: CoreAdminRequest.createCore fails because name parameter isn't set (Sean Colombo via ryan)
|
||||
|
||||
10. SOLR-869: Fix file descriptor leak in SolrResourceLoader#getLines (Mark Miller, shalin)
|
||||
|
||||
|
||||
Other Changes
|
||||
----------------------
|
||||
|
|
|
@ -236,17 +236,23 @@ public class SolrResourceLoader implements ResourceLoader
|
|||
|
||||
public List<String> getLines(String resource, Charset charset) throws IOException{
|
||||
BufferedReader input = null;
|
||||
input = new BufferedReader(new InputStreamReader(openResource(resource),
|
||||
charset));
|
||||
ArrayList<String> lines;
|
||||
try {
|
||||
input = new BufferedReader(new InputStreamReader(openResource(resource),
|
||||
charset));
|
||||
|
||||
ArrayList<String> lines = new ArrayList<String>();
|
||||
for (String word=null; (word=input.readLine())!=null;) {
|
||||
// skip comments
|
||||
if (word.startsWith("#")) continue;
|
||||
word=word.trim();
|
||||
// skip blank lines
|
||||
if (word.length()==0) continue;
|
||||
lines.add(word);
|
||||
lines = new ArrayList<String>();
|
||||
for (String word=null; (word=input.readLine())!=null;) {
|
||||
// skip comments
|
||||
if (word.startsWith("#")) continue;
|
||||
word=word.trim();
|
||||
// skip blank lines
|
||||
if (word.length()==0) continue;
|
||||
lines.add(word);
|
||||
}
|
||||
} finally {
|
||||
if (input != null)
|
||||
input.close();
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue