Close stream in FileUtils.addLines()

This commit is contained in:
Florian Schmaus 2018-08-13 16:39:56 +02:00
parent 5517d03fae
commit 6fb95d6226
1 changed files with 8 additions and 3 deletions

View File

@ -90,9 +90,14 @@ public final class FileUtils {
InputStream is = getStreamForUri(uri, null);
InputStreamReader sr = new InputStreamReader(is, StringUtils.UTF8);
BufferedReader br = new BufferedReader(sr);
String line;
while ((line = br.readLine()) != null) {
set.add(line);
try {
String line;
while ((line = br.readLine()) != null) {
set.add(line);
}
}
finally {
br.close();
}
return true;
}