You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by kw...@apache.org on 2018/08/11 11:09:07 UTC
lucene-solr:master: LUCENE-8451: Interpret IllegalArgumentException
result from convex polygon constructor as meaning a tiling failure.
Repository: lucene-solr
Updated Branches:
refs/heads/master e9addea08 -> f2c0005e9
LUCENE-8451: Interpret IllegalArgumentException result from convex polygon constructor as meaning a tiling failure.
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/f2c0005e
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/f2c0005e
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/f2c0005e
Branch: refs/heads/master
Commit: f2c0005e9d74208af5466e10a45e6c81d5be4770
Parents: e9addea
Author: Karl Wright <Da...@gmail.com>
Authored: Sat Aug 11 06:58:50 2018 -0400
Committer: Karl Wright <Da...@gmail.com>
Committed: Sat Aug 11 06:58:50 2018 -0400
----------------------------------------------------------------------
.../spatial3d/geom/GeoPolygonFactory.java | 33 ++++++++++++--------
.../lucene/spatial3d/geom/GeoPolygonTest.java | 2 +-
2 files changed, 21 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f2c0005e/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoPolygonFactory.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoPolygonFactory.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoPolygonFactory.java
index af5d8ef..301d1cc 100755
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoPolygonFactory.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoPolygonFactory.java
@@ -1443,23 +1443,30 @@ public class GeoPolygonFactory {
}
// Now, construct the polygon
- if (testPoint != null && holes != null && holes.size() > 0) {
- // No holes, for test
- final GeoPolygon testPolygon = new GeoConvexPolygon(planetModel, points, null, internalEdges, returnIsInternal);
- if (testPolygon.isWithin(testPoint)) {
- return null;
+ // Failures in construction mean we have a polygon that is too large (>180 degrees)
+ try {
+ if (testPoint != null && holes != null && holes.size() > 0) {
+ // No holes, for test
+ final GeoPolygon testPolygon = new GeoConvexPolygon(planetModel, points, null, internalEdges, returnIsInternal);
+ if (testPolygon.isWithin(testPoint)) {
+ return null;
+ }
}
- }
-
- final GeoPolygon realPolygon = new GeoConvexPolygon(planetModel, points, holes, internalEdges, returnIsInternal);
- if (testPoint != null && (holes == null || holes.size() == 0)) {
- if (realPolygon.isWithin(testPoint)) {
- return null;
+
+ final GeoPolygon realPolygon = new GeoConvexPolygon(planetModel, points, holes, internalEdges, returnIsInternal);
+ if (testPoint != null && (holes == null || holes.size() == 0)) {
+ if (realPolygon.isWithin(testPoint)) {
+ return null;
+ }
}
+
+ rval.addShape(realPolygon);
+ return true;
+
+ } catch (IllegalArgumentException e) {
+ throw new TileException(e.getMessage());
}
- rval.addShape(realPolygon);
- return true;
}
/** Check if a point is within a set of edges.
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f2c0005e/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoPolygonTest.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoPolygonTest.java b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoPolygonTest.java
index d68db13..dbdfa5e 100755
--- a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoPolygonTest.java
+++ b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/GeoPolygonTest.java
@@ -1890,7 +1890,7 @@ shape:
}
@Test
- @AwaitsFix(bugUrl="https://issues.apache.org/jira/browse/LUCENE-8451")
+ //@AwaitsFix(bugUrl="https://issues.apache.org/jira/browse/LUCENE-8451")
public void testLUCENE8451() {
//POLYGON((-2.5185339401969213 -24.093993739745027,0.0 8.828539494442529E-27,5.495998489568957E-11 -8.321407453133E-11,2.7174659198424288E-11 1.0260761462208114E-10,88.32137548549387 16.934529875343244,-87.97237709688223 39.919704493657484,-88.0876897472551 34.91204903885665,-2.5185339401969213 -24.093993739745027))
final List<GeoPoint> points = new ArrayList<>();