Skip to content
Snippets Groups Projects
Commit b9ee18c4 authored by OZGCloud's avatar OZGCloud
Browse files

Merge pull request 'fix resource leak' (#354) from FixResourceLeak into master

parents 06be6582 02adcff3
No related branches found
No related tags found
No related merge requests found
......@@ -79,13 +79,14 @@ class LandesnetzInfoReadService {
}
Set<String> readFile(InputStream fileInputStream) {
var fileScanner = new Scanner(fileInputStream, StandardCharsets.UTF_8);
try(var fileScanner = new Scanner(fileInputStream, StandardCharsets.UTF_8)){
while (fileScanner.hasNextLine()) {
String line = fileScanner.nextLine();
var line = fileScanner.nextLine();
if (isStartOfSection(line)) {
return readSection(fileScanner);
}
}
}
return Collections.emptySet();
}
......@@ -94,9 +95,9 @@ class LandesnetzInfoReadService {
}
Set<String> readSection(Scanner sectionScanner) {
Set<String> result = new HashSet<>();
var result = new HashSet<String>();
while (sectionScanner.hasNextLine()) {
String line = sectionScanner.nextLine();
var line = sectionScanner.nextLine();
if (isEndOfSection(line)) {
return Collections.unmodifiableSet(result);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment