Closed adam-collins closed 4 months ago
Currently testing with branch https://github.com/gbif/pipelines/tree/ala-2024
I've handled all the exceptions found in GBIF's data, and wrapped the parser to catch any possible other exceptions and return a general INTERPRETATION_ERROR issue.
I double checked. The parser is throwing exceptions for some data.
new IsoDateInterval(from, to)
without testing from < to
and without catching the exception thrown.Can be reproduced with:
String date = "1922-11-02T21:01/1922-11-02T01:01";
Map<String, String> map = new HashMap<>();
map.put(DwcTerm.eventDate.qualifiedName(), date);
map.put(DwcTerm.year.qualifiedName(), "1922");
map.put(DwcTerm.month.qualifiedName(), "11");
map.put(DwcTerm.day.qualifiedName(), "2");
ExtendedRecord er = ExtendedRecord.newBuilder().setId("1").setCoreTerms(map).build();
TemporalRecord tr = TemporalRecord.newBuilder().setId("1").build();
TemporalInterpreter temporalInterpreter =
TemporalInterpreter.builder().explicitRangeEnd(false).create();
temporalInterpreter.interpretTemporal(er, tr);
Reproduce with:
String date = "1922-11-02T21:01/1922-11-02";
Map<String, String> map = new HashMap<>();
map.put(DwcTerm.eventDate.qualifiedName(), date);
ExtendedRecord er = ExtendedRecord.newBuilder().setId("1").setCoreTerms(map).build();
TemporalRecord tr = TemporalRecord.newBuilder().setId("1").build();
TemporalInterpreter temporalInterpreter =
TemporalInterpreter.builder().explicitRangeEnd(false).create();
temporalInterpreter.interpretTemporal(er, tr);
It appears I misunderstood a reply. Inclusion of a link to a pull request or commit, or a pull request or commit referencing this issue would have helped me.
Running the TemporalInterpreter::interpretTemporal is throwing new exceptions for invalid eventDate ranges. e.g.
1922-11-02T21:01/1922-11-02T01:01
throwsInvalid range: (1922-11-02T21:01, 1922-11-02T01:01)
1918-07-21T20:01:00/1918-07-21
, throwsUnable to obtain LocalDateTime from TemporalAccessor: 1918-07-21 of type java.time.LocalDate
I think the old behaviour was to set the parsed eventDate to the first part of the invalid date range, e.g.
1921-12-15T21:31:00/1921-12-15T01:31:00
sets the eventDate to1921-12-16
example and code