diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-09-23 21:46:25 +1200 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-09-23 21:46:25 +1200 |
commit | 6e2387149e8758a6ea0c0788c0f70287ac8a36f1 (patch) | |
tree | c5341792e41595b3b0416dfd2df59f06b2bb6b5d /src/org/traccar/geocode/MapQuestReverseGeocoder.java | |
parent | a307569274f315c786fa4b342f97dd9e1ac0a213 (diff) | |
download | traccar-server-6e2387149e8758a6ea0c0788c0f70287ac8a36f1.tar.gz traccar-server-6e2387149e8758a6ea0c0788c0f70287ac8a36f1.tar.bz2 traccar-server-6e2387149e8758a6ea0c0788c0f70287ac8a36f1.zip |
Fix minor formatting issues
Diffstat (limited to 'src/org/traccar/geocode/MapQuestReverseGeocoder.java')
-rw-r--r-- | src/org/traccar/geocode/MapQuestReverseGeocoder.java | 58 |
1 files changed, 27 insertions, 31 deletions
diff --git a/src/org/traccar/geocode/MapQuestReverseGeocoder.java b/src/org/traccar/geocode/MapQuestReverseGeocoder.java index e1ed18918..a815ca40f 100644 --- a/src/org/traccar/geocode/MapQuestReverseGeocoder.java +++ b/src/org/traccar/geocode/MapQuestReverseGeocoder.java @@ -30,39 +30,35 @@ public class MapQuestReverseGeocoder extends JsonReverseGeocoder { @Override protected Address parseAddress(JsonObject json) { - JsonArray result = json.getJsonArray("results"); + JsonArray result = json.getJsonArray("results"); if (result != null) { - JsonObject result1 = result.getJsonObject(0); - JsonArray location = result1.getJsonArray("locations"); - if (location != null) { - JsonObject location1 = location.getJsonObject(0); - - Address address = new Address(); + JsonArray locations = result.getJsonObject(0).getJsonArray("locations"); + if (locations != null) { + JsonObject location = locations.getJsonObject(0); + + Address address = new Address(); - if (location1.containsKey("street")) { - address.setStreet(location1.getString("street")); - } - - if (location1.containsKey("adminArea5")) { - address.setSettlement(location1.getString("adminArea5")); - } - - if (location1.containsKey("adminArea4")) { - address.setDistrict(location1.getString("adminArea4")); - } - - if (location1.containsKey("adminArea3")) { - address.setState(location1.getString("adminArea3")); - } - - if (location1.containsKey("adminArea1")) { - address.setCountry(location1.getString("adminArea1").toUpperCase()); - } - - if (location1.containsKey("postalCode")) { - address.setPostcode(location1.getString("postalCode")); - } return address; - } + if (location.containsKey("street")) { + address.setStreet(location.getString("street")); + } + if (location.containsKey("adminArea5")) { + address.setSettlement(location.getString("adminArea5")); + } + if (location.containsKey("adminArea4")) { + address.setDistrict(location.getString("adminArea4")); + } + if (location.containsKey("adminArea3")) { + address.setState(location.getString("adminArea3")); + } + if (location.containsKey("adminArea1")) { + address.setCountry(location.getString("adminArea1").toUpperCase()); + } + if (location.containsKey("postalCode")) { + address.setPostcode(location.getString("postalCode")); + } + + return address; + } } return null; } |