mirror of
https://github.com/ilri/cgspace-java-helpers.git
synced 2024-11-22 23:05:12 +01:00
Add TODO about using try-with-resource
This would automatically close the BufferedReader after we are done with it, but it also means that the JSON object we create is lost when we exit the try() scope... See: https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html
This commit is contained in:
parent
af708933b2
commit
9089ffb66f
@ -72,6 +72,7 @@ public class CountryCodeTagger extends AbstractCurationTask
|
||||
} else {
|
||||
Gson gson = new Gson();
|
||||
|
||||
// TODO: convert to try: https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(this.getClass().getResourceAsStream(isocodesJsonPath)));
|
||||
CountriesVocabulary isocodesCountriesJson = gson.fromJson(reader, CountriesVocabulary.class);
|
||||
reader.close();
|
||||
|
Loading…
Reference in New Issue
Block a user