From 5bf566660bc729b88d8846e835029b8f348adca9 Mon Sep 17 00:00:00 2001 From: Shay Banon Date: Fri, 28 Sep 2012 22:29:08 +0200 Subject: [PATCH] fix detection when JTS / spatial4j are not available --- .../org/elasticsearch/common/geo/ShapesAvailability.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/elasticsearch/common/geo/ShapesAvailability.java b/src/main/java/org/elasticsearch/common/geo/ShapesAvailability.java index 0ce2087f5f3..e6c45853c9d 100644 --- a/src/main/java/org/elasticsearch/common/geo/ShapesAvailability.java +++ b/src/main/java/org/elasticsearch/common/geo/ShapesAvailability.java @@ -19,8 +19,7 @@ package org.elasticsearch.common.geo; -import com.spatial4j.core.shape.impl.PointImpl; -import com.vividsolutions.jts.geom.GeometryFactory; +import org.elasticsearch.common.Classes; /** */ @@ -32,7 +31,7 @@ public class ShapesAvailability { static { boolean xSPATIAL4J_AVAILABLE; try { - new PointImpl(0, 0, GeoShapeConstants.SPATIAL_CONTEXT); + Classes.getDefaultClassLoader().loadClass("com.spatial4j.core.shape.impl.PointImpl"); xSPATIAL4J_AVAILABLE = true; } catch (Throwable t) { xSPATIAL4J_AVAILABLE = false; @@ -41,7 +40,7 @@ public class ShapesAvailability { boolean xJTS_AVAILABLE; try { - new GeometryFactory(); + Classes.getDefaultClassLoader().loadClass("com.vividsolutions.jts.geom.GeometryFactory"); xJTS_AVAILABLE = true; } catch (Throwable t) { xJTS_AVAILABLE = false;