From 5bb9084bd5892d7906455c96319027ad6daae85b Mon Sep 17 00:00:00 2001 From: Karl Wright Date: Tue, 19 Apr 2016 12:06:15 -0400 Subject: [PATCH] Fix test to recognize null polygon response. --- .../test/org/apache/lucene/spatial/spatial4j/Geo3dRptTest.java | 3 +++ .../spatial/spatial4j/Geo3dShapeRectRelationTestCase.java | 3 +++ 2 files changed, 6 insertions(+) diff --git a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/spatial4j/Geo3dRptTest.java b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/spatial4j/Geo3dRptTest.java index 5f42e4ff80e..fa5900ffd4b 100644 --- a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/spatial4j/Geo3dRptTest.java +++ b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/spatial4j/Geo3dRptTest.java @@ -145,6 +145,9 @@ public class Geo3dRptTest extends RandomSpatialOpStrategyTestCase { final int convexPointIndex = random().nextInt(vertexCount); //If we get this wrong, hopefully we get IllegalArgumentException try { final GeoShape shape = GeoPolygonFactory.makeGeoPolygon(PlanetModel.SPHERE, geoPoints); + if (shape == null) { + continue; + } return new Geo3dShape(shape, ctx); } catch (IllegalArgumentException e) { // This is what happens when we create a shape that is invalid. Although it is conceivable that there are cases where diff --git a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/spatial4j/Geo3dShapeRectRelationTestCase.java b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/spatial4j/Geo3dShapeRectRelationTestCase.java index f6f08ddf5fd..362809f82c9 100644 --- a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/spatial4j/Geo3dShapeRectRelationTestCase.java +++ b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/spatial4j/Geo3dShapeRectRelationTestCase.java @@ -186,6 +186,9 @@ public abstract class Geo3dShapeRectRelationTestCase extends RandomizedShapeTest } try { final GeoShape shape = GeoPolygonFactory.makeGeoPolygon(planetModel, geoPoints); + if (shape == null) { + continue; + } return new Geo3dShape(planetModel, shape, ctx); } catch (IllegalArgumentException e) { // This is what happens when we create a shape that is invalid. Although it is conceivable that there are cases where