aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/geocode/JsonReverseGeocoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/geocode/JsonReverseGeocoder.java')
-rw-r--r--src/org/traccar/geocode/JsonReverseGeocoder.java5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/org/traccar/geocode/JsonReverseGeocoder.java b/src/org/traccar/geocode/JsonReverseGeocoder.java
index feaaaa0ed..c43641245 100644
--- a/src/org/traccar/geocode/JsonReverseGeocoder.java
+++ b/src/org/traccar/geocode/JsonReverseGeocoder.java
@@ -42,15 +42,12 @@ public abstract class JsonReverseGeocoder implements ReverseGeocoder {
conn.setRequestProperty("Connection", "close"); // don't keep-alive connections
try {
InputStreamReader streamReader = new InputStreamReader(conn.getInputStream());
- JsonReader reader = Json.createReader(streamReader);
- try {
+ try (JsonReader reader = Json.createReader(streamReader)) {
Address address = parseAddress(reader.readObject());
while (streamReader.read() > 0); // make sure we reached the end
if (address != null) {
return format.format(address);
}
- } finally {
- reader.close();
}
} finally {
conn.disconnect();