Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust code for SpotBugs #112

Merged
merged 1 commit into from
Aug 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions src/main/java/org/joda/money/DefaultCurrencyUnitDataProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,14 @@ private List<String> loadFromFile(String fileName) throws Exception {
if (in == null) {
throw new FileNotFoundException("Data file " + fileName + " not found");
}
BufferedReader reader = new BufferedReader(new InputStreamReader(in, "UTF-8"));
String line;
List<String> content = new ArrayList<>();
while ((line = reader.readLine()) != null) {
content.add(line);
try (BufferedReader reader = new BufferedReader(new InputStreamReader(in, "UTF-8"))) {
String line;
List<String> content = new ArrayList<>();
while ((line = reader.readLine()) != null) {
content.add(line);
}
return content;
}
return content;
}
}

Expand All @@ -82,10 +83,11 @@ private List<String> loadFromFiles(String fileName) throws Exception {
while (en.hasMoreElements()) {
URL url = (URL) en.nextElement();
try (InputStream in = url.openStream()) {
BufferedReader reader = new BufferedReader(new InputStreamReader(in, "UTF-8"));
String line;
while ((line = reader.readLine()) != null) {
content.add(line);
try (BufferedReader reader = new BufferedReader(new InputStreamReader(in, "UTF-8"))) {
String line;
while ((line = reader.readLine()) != null) {
content.add(line);
}
}
}
}
Expand Down