From d7391bc0404887cd34f5b172ddf5fb9b76b0db96 Mon Sep 17 00:00:00 2001 From: Przemyslaw Gomulka Date: Thu, 8 Oct 2020 15:35:13 +0200 Subject: [PATCH] [7.10] Fix incorrect use of Format.equals instead of matches backport#63462 #63463 closes #63459 backports #63462 --- server/src/main/java/org/elasticsearch/common/joda/Joda.java | 2 +- .../elasticsearch/common/joda/JavaJodaTimeDuellingTests.java | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/common/joda/Joda.java b/server/src/main/java/org/elasticsearch/common/joda/Joda.java index 7999f7c9dc630..48dd1518605bf 100644 --- a/server/src/main/java/org/elasticsearch/common/joda/Joda.java +++ b/server/src/main/java/org/elasticsearch/common/joda/Joda.java @@ -157,7 +157,7 @@ public static JodaDateFormatter forPattern(String input) { formatter = ISODateTimeFormat.weekDateTime(); } else if (FormatNames.WEEK_DATE_TIME_NO_MILLIS.matches(input)) { formatter = ISODateTimeFormat.weekDateTimeNoMillis(); - } else if (FormatNames.WEEKYEAR.equals(input)) { + } else if (FormatNames.WEEKYEAR.matches(input)) { getDeprecationLogger() .deprecate("week_year_format_name", "Format name \"week_year\" is deprecated and will be removed in a future version. " + "Use \"weekyear\" format instead"); diff --git a/server/src/test/java/org/elasticsearch/common/joda/JavaJodaTimeDuellingTests.java b/server/src/test/java/org/elasticsearch/common/joda/JavaJodaTimeDuellingTests.java index 5310279942387..094affb08b79b 100644 --- a/server/src/test/java/org/elasticsearch/common/joda/JavaJodaTimeDuellingTests.java +++ b/server/src/test/java/org/elasticsearch/common/joda/JavaJodaTimeDuellingTests.java @@ -251,7 +251,6 @@ public void testCustomTimeFormats() { // assertSamePrinterOutput("E, d MMM yyyy HH:mm:ss Z", LocaleUtils.parse("de"), javaTimeNow, dateTimeNow); // } - @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/63459") public void testDuellingFormatsValidParsing() { assertSameDate("1522332219", "epoch_second"); assertSameDate("0", "epoch_second"); @@ -761,7 +760,6 @@ public void testDuelingStrictParsing() { assertParseException("2012-W1-1", "strict_weekyear_week_day"); } - @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/63459") public void testSamePrinterOutput() { int year = randomIntBetween(1970, 2030); int month = randomIntBetween(1, 12);