incubator-blur-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amccu...@apache.org
Subject [07/18] git commit: Adding an error message instead of NPE for missing required argument. Fixed BLUR-351.
Date Wed, 01 Jul 2015 19:29:23 GMT
Adding an error message instead of NPE for missing required argument.  Fixed BLUR-351.


Project: http://git-wip-us.apache.org/repos/asf/incubator-blur/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-blur/commit/1c7aba26
Tree: http://git-wip-us.apache.org/repos/asf/incubator-blur/tree/1c7aba26
Diff: http://git-wip-us.apache.org/repos/asf/incubator-blur/diff/1c7aba26

Branch: refs/heads/blur-0.2.4-parcel
Commit: 1c7aba2619270aa64747f2dae6fc7756e51d382a
Parents: 47ff433
Author: Aaron McCurry <amccurry@gmail.com>
Authored: Wed Jun 24 07:44:21 2015 -0400
Committer: Aaron McCurry <amccurry@gmail.com>
Committed: Wed Jun 24 07:44:21 2015 -0400

----------------------------------------------------------------------
 .../analysis/type/spatial/BaseSpatialFieldTypeDefinition.java | 7 +++++--
 ...SpatialRecursivePrefixTreeStrategyFieldTypeDefinition.java | 2 +-
 ...SpatialTermQueryPrefixTreeStrategyFieldTypeDefinition.java | 2 +-
 3 files changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/1c7aba26/blur-query/src/main/java/org/apache/blur/analysis/type/spatial/BaseSpatialFieldTypeDefinition.java
----------------------------------------------------------------------
diff --git a/blur-query/src/main/java/org/apache/blur/analysis/type/spatial/BaseSpatialFieldTypeDefinition.java
b/blur-query/src/main/java/org/apache/blur/analysis/type/spatial/BaseSpatialFieldTypeDefinition.java
index f442232..2533813 100644
--- a/blur-query/src/main/java/org/apache/blur/analysis/type/spatial/BaseSpatialFieldTypeDefinition.java
+++ b/blur-query/src/main/java/org/apache/blur/analysis/type/spatial/BaseSpatialFieldTypeDefinition.java
@@ -122,9 +122,12 @@ public abstract class BaseSpatialFieldTypeDefinition extends CustomFieldTypeDefi
     return _shapeReadWriter.readShape(column.getValue());
   }
 
-  protected SpatialPrefixTree getSpatialPrefixTree(Map<String, String> properties)
{
+  protected SpatialPrefixTree getSpatialPrefixTree(String field, Map<String, String>
properties) {
     String spatialPrefixTreeStr = properties.get(SPATIAL_PREFIX_TREE);
-    if (spatialPrefixTreeStr.equals(GEOHASH_PREFIX_TREE)) {
+    if (spatialPrefixTreeStr == null) {
+      throw new IllegalArgumentException("Property [" + SPATIAL_PREFIX_TREE + "] is missing
from type def for field ["
+          + field + "]");
+    } else if (spatialPrefixTreeStr.equals(GEOHASH_PREFIX_TREE)) {
       int maxLevels = getMaxLevels(properties);
       return new GeohashPrefixTree(_ctx, maxLevels);
     } else if (spatialPrefixTreeStr.equals(QUAD_PREFIX_TREE)) {

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/1c7aba26/blur-query/src/main/java/org/apache/blur/analysis/type/spatial/SpatialRecursivePrefixTreeStrategyFieldTypeDefinition.java
----------------------------------------------------------------------
diff --git a/blur-query/src/main/java/org/apache/blur/analysis/type/spatial/SpatialRecursivePrefixTreeStrategyFieldTypeDefinition.java
b/blur-query/src/main/java/org/apache/blur/analysis/type/spatial/SpatialRecursivePrefixTreeStrategyFieldTypeDefinition.java
index 29b4475..879cd0d 100644
--- a/blur-query/src/main/java/org/apache/blur/analysis/type/spatial/SpatialRecursivePrefixTreeStrategyFieldTypeDefinition.java
+++ b/blur-query/src/main/java/org/apache/blur/analysis/type/spatial/SpatialRecursivePrefixTreeStrategyFieldTypeDefinition.java
@@ -52,7 +52,7 @@ public class SpatialRecursivePrefixTreeStrategyFieldTypeDefinition extends
BaseS
   @Override
   public void configure(String fieldNameForThisInstance, Map<String, String> properties,
Configuration configuration) {
     _ctx = SpatialContext.GEO;
-    _grid = getSpatialPrefixTree(properties);
+    _grid = getSpatialPrefixTree(fieldNameForThisInstance, properties);
     boolean docValue = false;
     if (properties.get(DOC_VALUE) != null) {
       docValue = true;

http://git-wip-us.apache.org/repos/asf/incubator-blur/blob/1c7aba26/blur-query/src/main/java/org/apache/blur/analysis/type/spatial/SpatialTermQueryPrefixTreeStrategyFieldTypeDefinition.java
----------------------------------------------------------------------
diff --git a/blur-query/src/main/java/org/apache/blur/analysis/type/spatial/SpatialTermQueryPrefixTreeStrategyFieldTypeDefinition.java
b/blur-query/src/main/java/org/apache/blur/analysis/type/spatial/SpatialTermQueryPrefixTreeStrategyFieldTypeDefinition.java
index ab1e247..3ad7bf8 100644
--- a/blur-query/src/main/java/org/apache/blur/analysis/type/spatial/SpatialTermQueryPrefixTreeStrategyFieldTypeDefinition.java
+++ b/blur-query/src/main/java/org/apache/blur/analysis/type/spatial/SpatialTermQueryPrefixTreeStrategyFieldTypeDefinition.java
@@ -56,7 +56,7 @@ public class SpatialTermQueryPrefixTreeStrategyFieldTypeDefinition extends
BaseS
     if (properties.get(DOC_VALUE) != null) {
       docValue = true;
     }
-    _grid = getSpatialPrefixTree(properties);
+    _grid = getSpatialPrefixTree(fieldNameForThisInstance, properties);
     _strategy = new TermQueryPrefixTreeStrategy(_grid, fieldNameForThisInstance, docValue);
     _shapeReadWriter = new ShapeReadWriter<SpatialContext>(_ctx);
     addSupportedIndexedShapes(Point.class);


Mime
View raw message