]> git.aero2k.de Git - tmp/jakarta-migration.git/commitdiff
HM-5: Simplified code, added ambigous test
authorcesarvh <cesarv.h@berkeley.edu>
Tue, 6 Nov 2018 00:45:42 +0000 (16:45 -0800)
committercesarvh <cesarv.h@berkeley.edu>
Tue, 19 Mar 2019 19:40:40 +0000 (12:40 -0700)
services/structureddate/structureddate/src/main/java/org/collectionspace/services/structureddate/antlr/ANTLRStructuredDateEvaluator.java
services/structureddate/structureddate/src/test/resources/test-dates.yaml

index b9bdc23841580db93538059129e91a8f7cbd3960..5225d75d38e8904befc6da00152bd1e0b950e488 100644 (file)
@@ -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) + "'");
index 412f35faf549e98cf677212ba5bb3d90e2c9aa19..08939797b0e770c7824c5bffcb5e0d19d535fa81 100644 (file)
   "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]
                                          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"
   "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
 # -------------------------------------------------------------------------------------------------------