fix detection when JTS / spatial4j are not available
This commit is contained in:
parent
7d6c567e6f
commit
5bf566660b
|
@ -19,8 +19,7 @@
|
||||||
|
|
||||||
package org.elasticsearch.common.geo;
|
package org.elasticsearch.common.geo;
|
||||||
|
|
||||||
import com.spatial4j.core.shape.impl.PointImpl;
|
import org.elasticsearch.common.Classes;
|
||||||
import com.vividsolutions.jts.geom.GeometryFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
|
@ -32,7 +31,7 @@ public class ShapesAvailability {
|
||||||
static {
|
static {
|
||||||
boolean xSPATIAL4J_AVAILABLE;
|
boolean xSPATIAL4J_AVAILABLE;
|
||||||
try {
|
try {
|
||||||
new PointImpl(0, 0, GeoShapeConstants.SPATIAL_CONTEXT);
|
Classes.getDefaultClassLoader().loadClass("com.spatial4j.core.shape.impl.PointImpl");
|
||||||
xSPATIAL4J_AVAILABLE = true;
|
xSPATIAL4J_AVAILABLE = true;
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
xSPATIAL4J_AVAILABLE = false;
|
xSPATIAL4J_AVAILABLE = false;
|
||||||
|
@ -41,7 +40,7 @@ public class ShapesAvailability {
|
||||||
|
|
||||||
boolean xJTS_AVAILABLE;
|
boolean xJTS_AVAILABLE;
|
||||||
try {
|
try {
|
||||||
new GeometryFactory();
|
Classes.getDefaultClassLoader().loadClass("com.vividsolutions.jts.geom.GeometryFactory");
|
||||||
xJTS_AVAILABLE = true;
|
xJTS_AVAILABLE = true;
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
xJTS_AVAILABLE = false;
|
xJTS_AVAILABLE = false;
|
||||||
|
|
Loading…
Reference in New Issue