-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correctly check for errors when parsing text calendars
The SimpleDateFormat parse() method does not set the error index on the ParsePosition if there is an error. Instead, it only sets the normal index to the last successful parse position of the input string. Daffodil currently relies on the error index, which means our error checking is incorrect. Fortunately, in most cases, this doesn't matter because our error checking also requires that we parse the entire input string, so if the index is zero it wouldn't match the string length and we would still see it as an error. The one exception to this is if the input string is zero length, in which case we do not correctly error and just create a date/time with value zero. This is fixed by correctly checking index for zero instead of inspecting the error index. This also does a little refactoring to replace the very old cache implementation with the much newer Evaluatable for creating SimpleDateFormat instances. DAFFODIL-2821
- Loading branch information
1 parent
db12258
commit d670968
Showing
7 changed files
with
191 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.