Bug #8796

Year 0000 event dates in MySQL crash ES when using search:populate

Added by Mike Gale almost 7 years ago. Updated over 6 years ago.

Status:VerifiedStart date:08/11/2015
Priority:HighDue date:
Assignee:Dan Gillean% Done:

0%

Category:Information object
Target version:Release 2.3.0
Google Code Legacy ID: Tested version:2.3
Sponsored:No Requires documentation:

Description

To reproduce:

1. Create a new archival description
2. Set the creation date to 0000-00-00
3. Save

Result:

The archival description will not be present under browse / search subsequently (as the ES indexing failed).

Subsequently trying a php symfony search:populate from the CLI, results in the error:

index: /atom_cca/QubitInformationObject/3165262 caused MapperParsingException[failed to parse [dates.endDate]]; nested: MapperParsingException[failed to parse date field [0000-12-], tried both date format [dateOptionalTime], and timestamp number with locale []]; nested: IllegalArgumentException[Invalid format: "0000-12-" is malformed at "-"]; 

Expected result:

Our ES indexing code shouldn't choke when given a year 0000 date.

Ideally, we'd have a validator on dates that the user enters from the UI that denies them the ability to enter a year of 0000, since that year doesn't exist. But now we know there are clients out in the wild with these dates already in their data, so we'll have to make our indexing code more robust against this bug regardless.

I'll create a separate ticket for adding better date validation.

0001-Fix-edge-case-for-year-0000-end-dates-in-ES-8796.patch Magnifier (5.07 KB) Mike Gale, 08/11/2015 10:25 PM


Related issues

Related to Access to Memory (AtoM) - Bug #8797: Users can enter year '0000' for creation (and other?) events New 08/11/2015

History

#2 Updated by Mike Gale almost 7 years ago

  • Related to Bug #8797: Users can enter year '0000' for creation (and other?) events added

#3 Updated by Mike Gale almost 7 years ago

I tried thinking of a few workarounds, and the "best" one I could think of is: If we encounter a year 0000 date in the code here, then return null.

cal_days_in_month returns (bool)false if you pass it year 0000, so it doesn't really make sense as an end date at that point anyway.

#4 Updated by Mike Gale almost 7 years ago

  • File 0001-Fix-edge-case-for-year-0000-end-dates-in-ES-8796.patch added
  • Status changed from In progress to Code Review
  • Assignee changed from Mike Gale to José Raddaoui Marín

#5 Updated by Mike Gale almost 7 years ago

  • File deleted (0001-Fix-edge-case-for-year-0000-end-dates-in-ES-8796.patch)

#6 Updated by Mike Gale almost 7 years ago

Here's a better version of the patch, which renames the inaccurately named normalizeDateWithoutMonthOrYear to normalizeDateWithoutMonthOrDay and adds some extra comments.

#7 Updated by José Raddaoui Marín almost 7 years ago

  • Status changed from Code Review to Feedback
  • Assignee changed from José Raddaoui Marín to Mike Gale

Looks good!

#8 Updated by Mike Gale almost 7 years ago

  • Status changed from Feedback to QA/Review
  • Assignee changed from Mike Gale to Dan Gillean

merged qa/2.3.x

#9 Updated by Dan Gillean over 6 years ago

  • Category set to Information object
  • Status changed from QA/Review to Verified

Also available in: Atom PDF