Index: lucene/spatial/src/java/org/apache/lucene/spatial/bbox/BBoxStrategy.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- lucene/spatial/src/java/org/apache/lucene/spatial/bbox/BBoxStrategy.java (revision 1388474) +++ lucene/spatial/src/java/org/apache/lucene/spatial/bbox/BBoxStrategy.java (revision ) @@ -95,7 +95,7 @@ public Field[] createIndexableFields(Shape shape) { if (shape instanceof Rectangle) return createIndexableFields((Rectangle)shape); - throw new IllegalArgumentException("Can only index Rectangle, not " + shape); + throw new UnsupportedOperationException("Can only index Rectangle, not " + shape); } public Field[] createIndexableFields(Rectangle bbox) { @@ -150,7 +150,7 @@ private Query makeSpatialQuery(SpatialArgs args) { Shape shape = args.getShape(); if (!(shape instanceof Rectangle)) - throw new IllegalArgumentException("Can only query by Rectangle, not " + shape); + throw new UnsupportedOperationException("Can only query by Rectangle, not " + shape); Rectangle bbox = (Rectangle) shape; Query spatial = null; Index: lucene/spatial/src/java/org/apache/lucene/spatial/vector/TwoDoublesStrategy.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- lucene/spatial/src/java/org/apache/lucene/spatial/vector/TwoDoublesStrategy.java (revision 1388474) +++ lucene/spatial/src/java/org/apache/lucene/spatial/vector/TwoDoublesStrategy.java (revision ) @@ -18,7 +18,6 @@ */ import com.spatial4j.core.context.SpatialContext; -import com.spatial4j.core.exception.InvalidShapeException; import com.spatial4j.core.shape.Circle; import com.spatial4j.core.shape.Point; import com.spatial4j.core.shape.Rectangle; @@ -90,7 +89,7 @@ public Field[] createIndexableFields(Shape shape) { if (shape instanceof Point) return createIndexableFields((Point) shape); - throw new IllegalArgumentException("Can only index Point, not " + shape); + throw new UnsupportedOperationException("Can only index Point, not " + shape); } /** @see #createIndexableFields(com.spatial4j.core.shape.Shape) */ @@ -139,7 +138,7 @@ circle.getRadius() ); return new ConstantScoreQuery(vsf); } else { - throw new InvalidShapeException("Only Rectangles and Circles are currently supported, " + + throw new UnsupportedOperationException("Only Rectangles and Circles are currently supported, " + "found [" + shape.getClass() + "]");//TODO } } @@ -149,7 +148,7 @@ // For starters, just limit the bbox Shape shape = args.getShape(); if (!(shape instanceof Rectangle || shape instanceof Circle)) { - throw new InvalidShapeException("Only Rectangles and Circles are currently supported, " + + throw new UnsupportedOperationException("Only Rectangles and Circles are currently supported, " + "found [" + shape.getClass() + "]");//TODO } Index: lucene/spatial/src/test/org/apache/lucene/spatial/vector/TestTwoDoublesStrategy.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- lucene/spatial/src/test/org/apache/lucene/spatial/vector/TestTwoDoublesStrategy.java (revision 1388474) +++ lucene/spatial/src/test/org/apache/lucene/spatial/vector/TestTwoDoublesStrategy.java (revision ) @@ -18,7 +18,6 @@ */ import com.spatial4j.core.context.SpatialContext; -import com.spatial4j.core.exception.InvalidShapeException; import com.spatial4j.core.shape.Circle; import com.spatial4j.core.shape.Point; import org.apache.lucene.search.Query; @@ -50,7 +49,7 @@ assertNotNull(query); } - @Test(expected = InvalidShapeException.class) + @Test(expected = UnsupportedOperationException.class) public void testInvalidQueryShape() { Point point = ctx.makePoint(0, 0); SpatialArgs args = new SpatialArgs(SpatialOperation.Intersects, point); Index: lucene/spatial/src/java/org/apache/lucene/spatial/SpatialStrategy.java IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- lucene/spatial/src/java/org/apache/lucene/spatial/SpatialStrategy.java (revision 1388474) +++ lucene/spatial/src/java/org/apache/lucene/spatial/SpatialStrategy.java (revision ) @@ -96,6 +96,7 @@ * since it doesn't use it. * * @return Not null nor will it have null elements. + * @throws UnsupportedOperationException if given a shape incompatible with the strategy */ public abstract Field[] createIndexableFields(Shape shape); @@ -111,6 +112,10 @@ * and {@link Shape} from the supplied {@code args}. * The default implementation is *
return new ConstantScoreQuery(makeFilter(args));
+ * + * @throws UnsupportedOperationException If the strategy does not support the shape in {@code args} + * @throws org.apache.lucene.spatial.query.UnsupportedSpatialOperation If the strategy does not support the {@link + * org.apache.lucene.spatial.query.SpatialOperation} in {@code args}. */ public ConstantScoreQuery makeQuery(SpatialArgs args) { return new ConstantScoreQuery(makeFilter(args)); @@ -124,6 +129,10 @@ * {@link #makeQuery(org.apache.lucene.spatial.query.SpatialArgs)} * then this method could be simply: *
return new QueryWrapperFilter(makeQuery(args).getQuery());
+ * + * @throws UnsupportedOperationException If the strategy does not support the shape in {@code args} + * @throws org.apache.lucene.spatial.query.UnsupportedSpatialOperation If the strategy does not support the {@link + * org.apache.lucene.spatial.query.SpatialOperation} in {@code args}. */ public abstract Filter makeFilter(SpatialArgs args);