aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/geocode
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-08 15:08:33 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-08 15:08:33 +1300
commiteb4ee7a9d4d0f132546b164c3483d62eb9e9f0db (patch)
tree29bc56f0f67cd49bac31a50e415c614ed4b1c5dc /src/org/traccar/geocode
parent320d41863864485c5675c9bf8332ff0845e5e812 (diff)
downloadtrackermap-server-eb4ee7a9d4d0f132546b164c3483d62eb9e9f0db.tar.gz
trackermap-server-eb4ee7a9d4d0f132546b164c3483d62eb9e9f0db.tar.bz2
trackermap-server-eb4ee7a9d4d0f132546b164c3483d62eb9e9f0db.zip
Clean up reported PMD issues
Diffstat (limited to 'src/org/traccar/geocode')
-rw-r--r--src/org/traccar/geocode/BingMapsReverseGeocoder.java2
-rw-r--r--src/org/traccar/geocode/FactualReverseGeocoder.java2
-rw-r--r--src/org/traccar/geocode/GisgraphyReverseGeocoder.java2
-rw-r--r--src/org/traccar/geocode/GoogleReverseGeocoder.java22
-rw-r--r--src/org/traccar/geocode/JsonReverseGeocoder.java6
-rw-r--r--src/org/traccar/geocode/MapQuestReverseGeocoder.java2
-rw-r--r--src/org/traccar/geocode/NominatimReverseGeocoder.java2
-rw-r--r--src/org/traccar/geocode/OpenCageReverseGeocoder.java2
-rw-r--r--src/org/traccar/geocode/ReverseGeocoder.java2
9 files changed, 17 insertions, 25 deletions
diff --git a/src/org/traccar/geocode/BingMapsReverseGeocoder.java b/src/org/traccar/geocode/BingMapsReverseGeocoder.java
index 34c3e4922..8c47febef 100644
--- a/src/org/traccar/geocode/BingMapsReverseGeocoder.java
+++ b/src/org/traccar/geocode/BingMapsReverseGeocoder.java
@@ -29,7 +29,7 @@ public class BingMapsReverseGeocoder extends JsonReverseGeocoder {
}
@Override
- protected Address parseAddress(JsonObject json) {
+ public Address parseAddress(JsonObject json) {
JsonArray result = json.getJsonArray("resourceSets");
if (result != null) {
JsonObject location = result.getJsonObject(0).getJsonArray("resources").getJsonObject(0).getJsonObject("address");
diff --git a/src/org/traccar/geocode/FactualReverseGeocoder.java b/src/org/traccar/geocode/FactualReverseGeocoder.java
index 8f32cf624..6e5a48423 100644
--- a/src/org/traccar/geocode/FactualReverseGeocoder.java
+++ b/src/org/traccar/geocode/FactualReverseGeocoder.java
@@ -28,7 +28,7 @@ public class FactualReverseGeocoder extends JsonReverseGeocoder {
}
@Override
- protected Address parseAddress(JsonObject json) {
+ public Address parseAddress(JsonObject json) {
JsonObject result = json.getJsonObject("response").getJsonObject("data");
if (result != null) {
Address address = new Address();
diff --git a/src/org/traccar/geocode/GisgraphyReverseGeocoder.java b/src/org/traccar/geocode/GisgraphyReverseGeocoder.java
index 59c4de723..ef9209fca 100644
--- a/src/org/traccar/geocode/GisgraphyReverseGeocoder.java
+++ b/src/org/traccar/geocode/GisgraphyReverseGeocoder.java
@@ -28,7 +28,7 @@ public class GisgraphyReverseGeocoder extends JsonReverseGeocoder {
}
@Override
- protected Address parseAddress(JsonObject json) {
+ public Address parseAddress(JsonObject json) {
Address address = new Address();
JsonObject result = json.getJsonArray("result").getJsonObject(0);
diff --git a/src/org/traccar/geocode/GoogleReverseGeocoder.java b/src/org/traccar/geocode/GoogleReverseGeocoder.java
index ade49a38b..ca1d42000 100644
--- a/src/org/traccar/geocode/GoogleReverseGeocoder.java
+++ b/src/org/traccar/geocode/GoogleReverseGeocoder.java
@@ -30,7 +30,7 @@ public class GoogleReverseGeocoder extends JsonReverseGeocoder {
}
@Override
- protected Address parseAddress(JsonObject json) {
+ public Address parseAddress(JsonObject json) {
JsonArray results = json.getJsonArray("results");
if (!results.isEmpty()) {
@@ -43,35 +43,31 @@ public class GoogleReverseGeocoder extends JsonReverseGeocoder {
String value = component.getString("short_name");
- for (JsonString type : component.getJsonArray("types").getValuesAs(JsonString.class)) {
+ typesLoop: for (JsonString type : component.getJsonArray("types").getValuesAs(JsonString.class)) {
switch (type.getString()) {
case "street_number":
address.setHouse(value);
- break;
+ break typesLoop;
case "route":
address.setStreet(value);
- break;
+ break typesLoop;
case "locality":
address.setSettlement(value);
- break;
+ break typesLoop;
case "administrative_area_level_2":
address.setDistrict(value);
- break;
+ break typesLoop;
case "administrative_area_level_1":
address.setState(value);
- break;
+ break typesLoop;
case "country":
address.setCountry(value);
- break;
+ break typesLoop;
case "postal_code":
address.setPostcode(value);
- break;
- default:
- continue;
+ break typesLoop;
}
-
- break;
}
}
diff --git a/src/org/traccar/geocode/JsonReverseGeocoder.java b/src/org/traccar/geocode/JsonReverseGeocoder.java
index 25b8e7853..88150a299 100644
--- a/src/org/traccar/geocode/JsonReverseGeocoder.java
+++ b/src/org/traccar/geocode/JsonReverseGeocoder.java
@@ -18,14 +18,10 @@ package org.traccar.geocode;
import com.ning.http.client.AsyncCompletionHandler;
import com.ning.http.client.Response;
import org.traccar.Context;
-import org.traccar.helper.Log;
import javax.json.Json;
import javax.json.JsonObject;
import javax.json.JsonReader;
-import java.io.InputStreamReader;
-import java.net.HttpURLConnection;
-import java.net.URL;
import java.util.AbstractMap;
import java.util.Collections;
import java.util.LinkedHashMap;
@@ -84,6 +80,6 @@ public abstract class JsonReverseGeocoder implements ReverseGeocoder {
});
}
- protected abstract Address parseAddress(JsonObject json);
+ public abstract Address parseAddress(JsonObject json);
}
diff --git a/src/org/traccar/geocode/MapQuestReverseGeocoder.java b/src/org/traccar/geocode/MapQuestReverseGeocoder.java
index 7141ea020..be3f51b04 100644
--- a/src/org/traccar/geocode/MapQuestReverseGeocoder.java
+++ b/src/org/traccar/geocode/MapQuestReverseGeocoder.java
@@ -29,7 +29,7 @@ public class MapQuestReverseGeocoder extends JsonReverseGeocoder {
}
@Override
- protected Address parseAddress(JsonObject json) {
+ public Address parseAddress(JsonObject json) {
JsonArray result = json.getJsonArray("results");
if (result != null) {
JsonArray locations = result.getJsonObject(0).getJsonArray("locations");
diff --git a/src/org/traccar/geocode/NominatimReverseGeocoder.java b/src/org/traccar/geocode/NominatimReverseGeocoder.java
index 763987eae..933d9389c 100644
--- a/src/org/traccar/geocode/NominatimReverseGeocoder.java
+++ b/src/org/traccar/geocode/NominatimReverseGeocoder.java
@@ -28,7 +28,7 @@ public class NominatimReverseGeocoder extends JsonReverseGeocoder {
}
@Override
- protected Address parseAddress(JsonObject json) {
+ public Address parseAddress(JsonObject json) {
JsonObject result = json.getJsonObject("address");
if (result != null) {
diff --git a/src/org/traccar/geocode/OpenCageReverseGeocoder.java b/src/org/traccar/geocode/OpenCageReverseGeocoder.java
index 1ad4aaf91..3104cb56a 100644
--- a/src/org/traccar/geocode/OpenCageReverseGeocoder.java
+++ b/src/org/traccar/geocode/OpenCageReverseGeocoder.java
@@ -29,7 +29,7 @@ public class OpenCageReverseGeocoder extends JsonReverseGeocoder {
}
@Override
- protected Address parseAddress(JsonObject json) {
+ public Address parseAddress(JsonObject json) {
JsonArray result = json.getJsonArray("results");
if (result != null) {
JsonObject location = result.getJsonObject(0).getJsonObject("components");
diff --git a/src/org/traccar/geocode/ReverseGeocoder.java b/src/org/traccar/geocode/ReverseGeocoder.java
index 1367e82dc..5d985fb31 100644
--- a/src/org/traccar/geocode/ReverseGeocoder.java
+++ b/src/org/traccar/geocode/ReverseGeocoder.java
@@ -17,7 +17,7 @@ package org.traccar.geocode;
public interface ReverseGeocoder {
- public interface ReverseGeocoderCallback {
+ interface ReverseGeocoderCallback {
void onResult(String address);