lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject svn commit: r1388985 - in /lucene.net/trunk: src/contrib/Spatial/BBox/BBoxStrategy.cs src/contrib/Spatial/Vector/TwoDoublesStrategy.cs test/contrib/Spatial/Vector/TestTwoDoublesStrategy.cs
Date Sun, 23 Sep 2012 09:05:16 GMT
Author: synhershko
Date: Sun Sep 23 09:05:16 2012
New Revision: 1388985

URL: http://svn.apache.org/viewvc?rev=1388985&view=rev
Log:
LUCENE-4413 Standardize on throwing UnsupportedOperationException for a shape the strategy
doesn't support

Modified:
    lucene.net/trunk/src/contrib/Spatial/BBox/BBoxStrategy.cs
    lucene.net/trunk/src/contrib/Spatial/Vector/TwoDoublesStrategy.cs
    lucene.net/trunk/test/contrib/Spatial/Vector/TestTwoDoublesStrategy.cs

Modified: lucene.net/trunk/src/contrib/Spatial/BBox/BBoxStrategy.cs
URL: http://svn.apache.org/viewvc/lucene.net/trunk/src/contrib/Spatial/BBox/BBoxStrategy.cs?rev=1388985&r1=1388984&r2=1388985&view=diff
==============================================================================
--- lucene.net/trunk/src/contrib/Spatial/BBox/BBoxStrategy.cs (original)
+++ lucene.net/trunk/src/contrib/Spatial/BBox/BBoxStrategy.cs Sun Sep 23 09:05:16 2012
@@ -77,7 +77,7 @@ namespace Lucene.Net.Spatial.BBox
             var rect = shape as Rectangle;
             if (rect != null)
                 return CreateIndexableFields(rect);
-            throw new ArgumentException("Can only index Rectangle, not " + shape, "shape");
+            throw new InvalidOperationException("Can only index Rectangle, not " + shape);
         }
 
         public AbstractField[] CreateIndexableFields(Rectangle bbox)
@@ -138,7 +138,7 @@ namespace Lucene.Net.Spatial.BBox
 		{
             var bbox = args.Shape as Rectangle;
             if (bbox == null)
-                throw new ArgumentException("Can only query by Rectangle, not " + args.Shape);
+                throw new InvalidOperationException("Can only query by Rectangle, not " +
args.Shape);
 
 			Query spatial = null;
 

Modified: lucene.net/trunk/src/contrib/Spatial/Vector/TwoDoublesStrategy.cs
URL: http://svn.apache.org/viewvc/lucene.net/trunk/src/contrib/Spatial/Vector/TwoDoublesStrategy.cs?rev=1388985&r1=1388984&r2=1388985&view=diff
==============================================================================
--- lucene.net/trunk/src/contrib/Spatial/Vector/TwoDoublesStrategy.cs (original)
+++ lucene.net/trunk/src/contrib/Spatial/Vector/TwoDoublesStrategy.cs Sun Sep 23 09:05:16
2012
@@ -77,7 +77,7 @@ namespace Lucene.Net.Spatial.Vector
 		    if (point != null)
 		        return CreateIndexableFields(point);
 
-		    throw new ArgumentException("Can only index Point, not " + shape);
+		    throw new InvalidOperationException("Can only index Point, not " + shape);
 		}
 
         public AbstractField[] CreateIndexableFields(Point point)
@@ -126,7 +126,7 @@ namespace Lucene.Net.Spatial.Vector
                 return new ConstantScoreQuery(vsf);
             }
             
-            throw new InvalidShapeException("Only Rectangles and Circles are currently supported,
" +
+            throw new InvalidOperationException("Only Rectangles and Circles are currently
supported, " +
                                             "found [" + shape.GetType().Name + "]"); //TODO
         }
 
@@ -136,7 +136,7 @@ namespace Lucene.Net.Spatial.Vector
 	        // For starters, just limit the bbox
 			var shape = args.Shape;
 			if (!(shape is Rectangle || shape is Circle))
-				throw new InvalidShapeException("Only Rectangles and Circles are currently supported,
found ["
+				throw new InvalidOperationException("Only Rectangles and Circles are currently supported,
found ["
 					+ shape.GetType().Name + "]");//TODO
 
 			Rectangle bbox = shape.GetBoundingBox();

Modified: lucene.net/trunk/test/contrib/Spatial/Vector/TestTwoDoublesStrategy.cs
URL: http://svn.apache.org/viewvc/lucene.net/trunk/test/contrib/Spatial/Vector/TestTwoDoublesStrategy.cs?rev=1388985&r1=1388984&r2=1388985&view=diff
==============================================================================
--- lucene.net/trunk/test/contrib/Spatial/Vector/TestTwoDoublesStrategy.cs (original)
+++ lucene.net/trunk/test/contrib/Spatial/Vector/TestTwoDoublesStrategy.cs Sun Sep 23 09:05:16
2012
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 
+using System;
 using Lucene.Net.Search;
 using Lucene.Net.Spatial.Queries;
 using Lucene.Net.Spatial.Vector;
@@ -50,7 +51,7 @@ namespace Lucene.Net.Contrib.Spatial.Tes
 		{
             Point point = ctx.MakePoint(0, 0);
 			var args = new SpatialArgs(SpatialOperation.Intersects, point);
-			Assert.Throws<InvalidShapeException>(() => this.strategy.MakeQuery(args));
+			Assert.Throws<InvalidOperationException>(() => this.strategy.MakeQuery(args));
 		}
 
 		[Test]



Mime
View raw message