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 2015/04/21 18:37:21 UTC
svn commit: r1675152 - in /lucene/dev/branches/branch_5x/lucene:
core/src/java/org/apache/lucene/search/Explanation.java
spatial/src/java/org/apache/lucene/spatial/bbox/BBoxOverlapRatioValueSource.java
Author: jpountz
Date: Tue Apr 21 16:37:21 2015
New Revision: 1675152
URL: http://svn.apache.org/r1675152
Log:
LUCENE-6446: Protected against null sub explanations.
Modified:
lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/search/Explanation.java
lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/bbox/BBoxOverlapRatioValueSource.java
Modified: lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/search/Explanation.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/search/Explanation.java?rev=1675152&r1=1675151&r2=1675152&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/search/Explanation.java (original)
+++ lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/search/Explanation.java Tue Apr 21 16:37:21 2015
@@ -72,6 +72,9 @@ public class Explanation {
this.value = value;
this.description = Objects.requireNonNull(description);
this.details = Collections.unmodifiableList(new ArrayList<>(details));
+ for (Explanation detail : details) {
+ Objects.requireNonNull(detail);
+ }
}
/**
Modified: lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/bbox/BBoxOverlapRatioValueSource.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/bbox/BBoxOverlapRatioValueSource.java?rev=1675152&r1=1675151&r2=1675152&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/bbox/BBoxOverlapRatioValueSource.java (original)
+++ lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/bbox/BBoxOverlapRatioValueSource.java Tue Apr 21 16:37:21 2015
@@ -134,8 +134,12 @@ public class BBoxOverlapRatioValueSource
double top = Math.min(queryExtent.getMaxY(), target.getMaxY());
double bottom = Math.max(queryExtent.getMinY(), target.getMinY());
double height = top - bottom;
- if (height < 0)
+ if (height < 0) {
+ if (exp != null) {
+ exp.set(Explanation.noMatch("No intersection"));
+ }
return 0;//no intersection
+ }
// calculate "width": the intersection width between two boxes.
double width = 0;
@@ -153,6 +157,9 @@ public class BBoxOverlapRatioValueSource
&& (Math.abs(b.getMinX()) == 180 || Math.abs(b.getMaxX()) == 180)) {
width = 0;//both adjacent to dateline
} else {
+ if (exp != null) {
+ exp.set(Explanation.noMatch("No intersection"));
+ }
return 0;//no intersection
}
} else {//both cross
@@ -174,8 +181,12 @@ public class BBoxOverlapRatioValueSource
if (qryEastLeft < qryEastRight)
width += qryEastRight - qryEastLeft;
- if (qryWestLeft > qryWestRight && qryEastLeft > qryEastRight)
+ if (qryWestLeft > qryWestRight && qryEastLeft > qryEastRight) {
+ if (exp != null) {
+ exp.set(Explanation.noMatch("No intersection"));
+ }
return 0;//no intersection
+ }
}
}