File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed
server/src/test/java/org/elasticsearch/search/query
test/framework/src/main/java/org/elasticsearch/test Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -426,14 +426,11 @@ public void testDateRangeInQueryString() {
426426 assertThat (e .toString (), containsString ("unit [D] not supported for date math" ));
427427 }
428428
429- @ AwaitsFix (bugUrl = "https://github.com/elastic/elasticsearch/issues/37814" )
430429 // Issue #7880
431430 public void testDateRangeInQueryStringWithTimeZone_7880 () {
432431 //the mapping needs to be provided upfront otherwise we are not sure how many failures we get back
433432 //as with dynamic mappings some shards might be lacking behind and parse a different query
434- assertAcked (prepareCreate ("test" ).addMapping (
435- "type" , "past" , "type=date"
436- ));
433+ assertAcked (prepareCreate ("test" ).addMapping ("type" , "past" , "type=date" ));
437434
438435 ZoneId timeZone = randomZone ();
439436 String now = DateFormatter .forPattern ("strict_date_optional_time" ).format (Instant .now ().atZone (timeZone ));
Original file line number Diff line number Diff line change 4848import org .apache .lucene .util .TimeUnits ;
4949import org .elasticsearch .Version ;
5050import org .elasticsearch .bootstrap .BootstrapForTesting ;
51+ import org .elasticsearch .bootstrap .JavaVersion ;
5152import org .elasticsearch .client .Requests ;
5253import org .elasticsearch .cluster .ClusterModule ;
5354import org .elasticsearch .cluster .metadata .IndexMetaData ;
@@ -784,7 +785,17 @@ public static TimeZone randomTimeZone() {
784785 * generate a random TimeZone from the ones available in java.time
785786 */
786787 public static ZoneId randomZone () {
787- return ZoneId .of (randomFrom (JAVA_ZONE_IDS ));
788+ // work around a JDK bug, where java 8 cannot parse the timezone GMT0 back into a temporal accessor
789+ // see https://bugs.openjdk.java.net/browse/JDK-8138664
790+ if (JavaVersion .current ().getVersion ().get (0 ) == 8 ) {
791+ ZoneId timeZone ;
792+ do {
793+ timeZone = ZoneId .of (randomFrom (JAVA_ZONE_IDS ));
794+ } while (timeZone .equals (ZoneId .of ("GMT0" )));
795+ return timeZone ;
796+ } else {
797+ return ZoneId .of (randomFrom (JAVA_ZONE_IDS ));
798+ }
788799 }
789800
790801 /**
You can’t perform that action at this time.
0 commit comments