aboutsummaryrefslogtreecommitdiffstats
path: root/main/src
diff options
context:
space:
mode:
Diffstat (limited to 'main/src')
-rw-r--r--main/src/cgeo/geocaching/cgData.java10
-rw-r--r--main/src/cgeo/geocaching/cgeocoords.java15
-rw-r--r--main/src/cgeo/geocaching/geopoint/Geopoint.java32
3 files changed, 4 insertions, 53 deletions
diff --git a/main/src/cgeo/geocaching/cgData.java b/main/src/cgeo/geocaching/cgData.java
index ba95ad4..37b20ad 100644
--- a/main/src/cgeo/geocaching/cgData.java
+++ b/main/src/cgeo/geocaching/cgData.java
@@ -5,7 +5,6 @@ import cgeo.geocaching.enumerations.CacheType;
import cgeo.geocaching.enumerations.WaypointType;
import cgeo.geocaching.files.LocalStorage;
import cgeo.geocaching.geopoint.Geopoint;
-import cgeo.geocaching.geopoint.Geopoint.MalformedCoordinateException;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
@@ -1465,14 +1464,7 @@ public class cgData {
return null;
}
- try {
- return new Geopoint(cursor.getDouble(indexLat), cursor.getDouble(indexLon));
- } catch (MalformedCoordinateException e) {
- // TODO: check whether the exception should be returned to the caller instead,
- // as it might want to remove an invalid geopoint from the database.
- Log.e(Settings.tag, "cannot parse geopoint from database: " + e.getMessage());
- return null;
- }
+ return new Geopoint(cursor.getDouble(indexLat), cursor.getDouble(indexLon));
}
/**
diff --git a/main/src/cgeo/geocaching/cgeocoords.java b/main/src/cgeo/geocaching/cgeocoords.java
index aafe9ec..533dc23 100644
--- a/main/src/cgeo/geocaching/cgeocoords.java
+++ b/main/src/cgeo/geocaching/cgeocoords.java
@@ -3,7 +3,6 @@ package cgeo.geocaching;
import cgeo.geocaching.Settings.coordInputFormatEnum;
import cgeo.geocaching.activity.AbstractActivity;
import cgeo.geocaching.geopoint.Geopoint;
-import cgeo.geocaching.geopoint.Geopoint.MalformedCoordinateException;
import cgeo.geocaching.geopoint.GeopointFormatter;
import cgeo.geocaching.geopoint.GeopointParser.ParseException;
@@ -358,11 +357,6 @@ public class cgeocoords extends Dialog {
context.showToast(context.getResources().getString(R.string.err_parse_lat_lon));
}
return false;
- } catch (MalformedCoordinateException e) {
- if (signalError) {
- context.showToast(context.getResources().getString(R.string.err_invalid_lat_lon));
- }
- return false;
}
return true;
}
@@ -411,14 +405,7 @@ public class cgeocoords extends Dialog {
latitude *= (bLat.getText().toString().equalsIgnoreCase("S") ? -1 : 1);
longitude *= (bLon.getText().toString().equalsIgnoreCase("W") ? -1 : 1);
- try {
- gp = new Geopoint(latitude, longitude);
- } catch (MalformedCoordinateException e) {
- if (signalError) {
- context.showToast(context.getResources().getString(R.string.err_invalid_lat_lon));
- }
- return false;
- }
+ gp = new Geopoint(latitude, longitude);
return true;
}
diff --git a/main/src/cgeo/geocaching/geopoint/Geopoint.java b/main/src/cgeo/geocaching/geopoint/Geopoint.java
index 6b00331..fc85f88 100644
--- a/main/src/cgeo/geocaching/geopoint/Geopoint.java
+++ b/main/src/cgeo/geocaching/geopoint/Geopoint.java
@@ -21,22 +21,11 @@ public final class Geopoint
* latitude
* @param lon
* longitude
- * @throws MalformedCoordinateException
- * if any coordinate is incorrect
*/
public Geopoint(final double lat, final double lon)
{
- if (lat <= 90 && lat >= -90) {
- latitude = lat;
- } else {
- throw new MalformedCoordinateException("malformed latitude: " + lat);
- }
- if (lon <= 180 && lon >= -180) {
- // Prefer 180 degrees rather than the equivalent -180.
- longitude = lon == -180 ? 180 : lon;
- } else {
- throw new MalformedCoordinateException("malformed longitude: " + lon);
- }
+ latitude = lat;
+ longitude = lon;
}
/**
@@ -46,8 +35,6 @@ public final class Geopoint
* latitude
* @param lon
* longitude
- * @throws MalformedCoordinateException
- * if any coordinate is incorrect
*/
public Geopoint(final int lat, final int lon)
{
@@ -61,8 +48,6 @@ public final class Geopoint
* string to parse
* @throws GeopointParser.ParseException
* if the string cannot be parsed
- * @throws MalformedCoordinateException
- * if any coordinate is incorrect
* @see GeopointParser.parse()
*/
public Geopoint(final String text) {
@@ -78,8 +63,6 @@ public final class Geopoint
* longitude string to parse
* @throws GeopointParser.ParseException
* if any argument string cannot be parsed
- * @throws MalformedCoordinateException
- * if any coordinate is incorrect
* @see GeopointParser.parse()
*/
public Geopoint(final String latText, final String lonText) {
@@ -259,15 +242,4 @@ public final class Geopoint
super(msg);
}
}
-
- public static class MalformedCoordinateException
- extends GeopointException
- {
- private static final long serialVersionUID = 1L;
-
- public MalformedCoordinateException(String msg)
- {
- super(msg);
- }
- }
}