LUCENE-7278: DRPT: fix bug in assert statement

(cherry picked from commit 1d35bd0)
This commit is contained in:
David Smiley 2016-05-12 23:03:32 -04:00
parent b77c16eeae
commit 32e16cb0e6
2 changed files with 4 additions and 3 deletions

View File

@ -20,7 +20,8 @@ New Features
queries with excluded bounds. (Adrien Grand)
* LUCENE-7278: Spatial-extras DateRangePrefixTree's Calendar is now configurable, to
e.g. clear the Gregorian Change Date. (David Smiley)
e.g. clear the Gregorian Change Date. Also, toString(cal) is now identical to
DateTimeFormatter.ISO_INSTANT. (David Smiley)
API Changes

View File

@ -256,10 +256,10 @@ public class DateRangePrefixTree extends NumberRangePrefixTree {
int assertEra = -1;
assert (assertEra = (((Calendar)cal.clone()).get(Calendar.ERA))) >= 0;//a trick to only get this if assert enabled
//note: Calendar.ERA == 0;
for (int f = field+1; f <= Calendar.MILLISECOND; f++) {
for (int f = field + 1; f <= Calendar.MILLISECOND; f++) {
cal.clear(f);
}
assert ((Calendar)cal.clone()).get(Calendar.ERA) == assertEra : "Calendar underflow";
assert field + 1 == Calendar.ERA || ((Calendar)cal.clone()).get(Calendar.ERA) == assertEra : "Calendar underflow";
}
/** Converts {@code value} from a {@link Calendar} or {@link Date} to a {@link Shape}. Other arguments