You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by jp...@apache.org on 2018/08/01 13:18:38 UTC

[2/2] lucene-solr:branch_7x: Fix AAIOOBE in GeoTestUtil.

Fix AAIOOBE in GeoTestUtil.


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/32d60c6a
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/32d60c6a
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/32d60c6a

Branch: refs/heads/branch_7x
Commit: 32d60c6a8f8b076fba0cafa00643b97b2c2357dd
Parents: 7396da5
Author: Adrien Grand <jp...@gmail.com>
Authored: Wed Aug 1 15:17:53 2018 +0200
Committer: Adrien Grand <jp...@gmail.com>
Committed: Wed Aug 1 15:18:29 2018 +0200

----------------------------------------------------------------------
 .../src/java/org/apache/lucene/geo/GeoTestUtil.java            | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/32d60c6a/lucene/test-framework/src/java/org/apache/lucene/geo/GeoTestUtil.java
----------------------------------------------------------------------
diff --git a/lucene/test-framework/src/java/org/apache/lucene/geo/GeoTestUtil.java b/lucene/test-framework/src/java/org/apache/lucene/geo/GeoTestUtil.java
index 8817d20..bb29b0b 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/geo/GeoTestUtil.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/geo/GeoTestUtil.java
@@ -245,7 +245,7 @@ public class GeoTestUtil {
       return new double[] { nextLatitudeBetween(polygon.minLat, polygon.maxLat), nextLongitudeBetween(polygon.minLon, polygon.maxLon) };
     } else if (surpriseMe < 20) {
       // target a vertex
-      int vertex = randomInt(polyLats.length - 1);
+      int vertex = randomInt(polyLats.length - 2);
       return new double[] { nextLatitudeNear(polyLats[vertex], polyLats[vertex+1] - polyLats[vertex]), 
                             nextLongitudeNear(polyLons[vertex], polyLons[vertex+1] - polyLons[vertex]) };
     } else if (surpriseMe < 30) {
@@ -253,12 +253,12 @@ public class GeoTestUtil {
       Polygon container = boxPolygon(new Rectangle(polygon.minLat, polygon.maxLat, polygon.minLon, polygon.maxLon));
       double containerLats[] = container.getPolyLats();
       double containerLons[] = container.getPolyLons();
-      int startVertex = randomInt(containerLats.length - 1);
+      int startVertex = randomInt(containerLats.length - 2);
       return nextPointAroundLine(containerLats[startVertex], containerLons[startVertex], 
                                  containerLats[startVertex+1], containerLons[startVertex+1]);
     } else {
       // target points around diagonals between vertices
-      int startVertex = randomInt(polyLats.length - 1);
+      int startVertex = randomInt(polyLats.length - 2);
       // but favor edges heavily
       int endVertex = randomBoolean() ? startVertex + 1 : randomInt(polyLats.length - 1);
       return nextPointAroundLine(polyLats[startVertex], polyLons[startVertex],