From: cesarvh Date: Tue, 6 Nov 2018 00:45:42 +0000 (-0800) Subject: HM-5: Simplified code, added ambigous test X-Git-Url: https://git.aero2k.de/?a=commitdiff_plain;h=4966dead7c0e3dc03dc268ef2a59887294d1b98d;p=tmp%2Fjakarta-migration.git HM-5: Simplified code, added ambigous test --- diff --git a/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/antlr/ANTLRStructuredDateEvaluator.java b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/antlr/ANTLRStructuredDateEvaluator.java index b9bdc2384..5225d75d3 100644 --- a/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/antlr/ANTLRStructuredDateEvaluator.java +++ b/services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/antlr/ANTLRStructuredDateEvaluator.java @@ -539,7 +539,6 @@ public class ANTLRStructuredDateEvaluator extends StructuredDateBaseListener imp stack.push(year); stack.push(numMonth); stack.push(dayOfMonth); - stack.push(era); if (dayOfMonth > 31 || dayOfMonth <= 0) { throw new StructuredDateFormatException("unexpected day of month '" + Integer.toString(dayOfMonth) + "'"); diff --git a/services/structureddate/structureddate/src/test/resources/test-dates.yaml b/services/structureddate/structureddate/src/test/resources/test-dates.yaml index 412f35faf..08939797b 100644 --- a/services/structureddate/structureddate/src/test/resources/test-dates.yaml +++ b/services/structureddate/structureddate/src/test/resources/test-dates.yaml @@ -1155,19 +1155,6 @@ "13 april 15": # oneDisplayDate - ambigous day and year - should be Year month day earliestSingleDate: [13, 4, 15, CE] - "13 april 1995": # oneDisplayDate - with question mark - earliestSingleDate: [1995, 4, 13, CE] - - "13 apr 1995": # oneDisplayDate - with question mark - earliestSingleDate: [1995, 4, 13, CE] - - "13th APRIL 1995": # oneDisplayDate - with question mark - earliestSingleDate: [1995, 4, 13, CE] - - "13 april 1995 - 13 april 2018": # Hyphenated range - with Day Month Year format - earliestSingleDate: [1995, 4, 13, CE] - latestDate: [2018, 4, 13, CE] - "before 13 april 1995": # beforeAfterDate - Empty earliestSingleDate - Day Month Year Format earliestSingleDate: [] latestDate: [1995, 4, 13, CE] @@ -1181,9 +1168,6 @@ earliestSingleDate: [1995, 4, 13, CE] latestDate: "current date" - "unknown": - earliestSingleDate: [] - "after april 13 1995": # beforeAfterDate - Empty latestDate calculated as current date - Month Day Year Format earliestSingleDate: [1995, 4, 13, CE] latestDate: "current date" @@ -1199,6 +1183,9 @@ "unknown": # Unknown date: Should result in empty fields earliestSingleDate: [] + "13 april 15": # oneDisplayDate - ambiguous day and year, intepreted as year month day + earliestSingleDate: [13, 4, 15, CE] + # ------------------------------------------------------------------------------------------------------- # Invalid dates # -------------------------------------------------------------------------------------------------------