Skip to content

Commit edf66bd

Browse files
author
Cameron Mace
authored
Added infinity exception to if statement inside Position object (#416)
* added infinity exception to if statement * reversed order * add ( )
1 parent 278cfbc commit edf66bd

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • mapbox/libjava-core/src/main/java/com/mapbox/services/commons/models

mapbox/libjava-core/src/main/java/com/mapbox/services/commons/models/Position.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ private Position(double longitude, double latitude, double altitude) {
3131
this.latitude = latitude;
3232
this.altitude = altitude;
3333

34-
if (latitude < -90 || latitude > 90) {
34+
if (latitude != Double.POSITIVE_INFINITY && (latitude < -90 || latitude > 90)) {
3535
// Checks the latitude value is within range or provide a warning otherwise
3636
logger.warning(String.format(Constants.DEFAULT_LOCALE,
3737
"Latitude value seems to be out of range (found: %f, expected: [-90, 90]). "
3838
+ "Did you accidentally reverse the longitude/latitude order?",
3939
latitude));
4040
}
4141

42-
if (longitude < -180 || longitude > 180) {
42+
if (longitude != Double.POSITIVE_INFINITY && (longitude < -180 || longitude > 180)) {
4343
// Checks the longitude value is within range or provide a warning otherwise
4444
logger.warning(String.format(Constants.DEFAULT_LOCALE,
4545
"Longitude value seems to be out of range (found: %f, expected: [-180, 180]). "

0 commit comments

Comments
 (0)