DATAMONGO-1607 - Fix ClassCastException in Circle, Point and Sphere when coordinates are not Double.
Original Pull Request: #438
This commit is contained in:
committed by
Christoph Strobl
parent
18e00a91f9
commit
7b5233c468
@@ -53,6 +53,7 @@ import com.mongodb.DBObject;
|
||||
* @author Thomas Darimont
|
||||
* @author Oliver Gierke
|
||||
* @author Christoph Strobl
|
||||
* @author Thiago Diniz da Silveira
|
||||
* @since 1.5
|
||||
*/
|
||||
abstract class GeoConverters {
|
||||
@@ -120,8 +121,11 @@ abstract class GeoConverters {
|
||||
if (source.containsField("type")) {
|
||||
return DbObjectToGeoJsonPointConverter.INSTANCE.convert(source);
|
||||
}
|
||||
|
||||
Number x = (Number) source.get("x");
|
||||
Number y = (Number) source.get("y");
|
||||
|
||||
return new Point((Double) source.get("x"), (Double) source.get("y"));
|
||||
return new Point(x.doubleValue(), y.doubleValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,7 +259,8 @@ abstract class GeoConverters {
|
||||
}
|
||||
|
||||
DBObject center = (DBObject) source.get("center");
|
||||
Double radius = (Double) source.get("radius");
|
||||
Number radiusNumber = (Number) source.get("radius");
|
||||
Double radius = radiusNumber.doubleValue();
|
||||
|
||||
Distance distance = new Distance(radius);
|
||||
|
||||
@@ -326,7 +331,9 @@ abstract class GeoConverters {
|
||||
}
|
||||
|
||||
DBObject center = (DBObject) source.get("center");
|
||||
Double radius = (Double) source.get("radius");
|
||||
Number radiusNumber = (Number) source.get("radius");
|
||||
Double radius = radiusNumber.doubleValue();
|
||||
|
||||
|
||||
Distance distance = new Distance(radius);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user