-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: don't throw exception on calendar with no days #1519
Conversation
Thanks for opening this pull request! You're awesome. We use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix. Examples of titles with semantic prefixes:
|
|
Chasing down a few of the changes in the acceptance tests, I think that's to be expected. For example looking running the current validator on https://storage.googleapis.com/storage/v1/b/mdb-latest/o/us-georgia-metropolitan-atlanta-rapid-transit-authority-marta-gtfs-368.zip?alt=media results in this error during the run:
and no expired calendar warnings. With this change there are no system errors during the run, but it now has two |
Hi @Whoops, I did a spot check on the acceptance test reports, and all new warnings are as expected as they were omitted by the previous implementation due to the exception. Great contribution! |
@davidgamez SEVERE: Runtime exception in validator org.mobilitydata.gtfsvalidator.validator.ExpiredCalendarValidator
java.util.NoSuchElementException: No value present
at java.base/java.util.Optional.get(Optional.java:148)
at org.mobilitydata.gtfsvalidator.validator.ExpiredCalendarValidator.validate(ExpiredCalendarValidator.java:61)
at org.mobilitydata.gtfsvalidator.validator.ValidatorUtil.safeValidate(ValidatorUtil.java:74)
at org.mobilitydata.gtfsvalidator.table.GtfsFeedLoader.lambda$loadAndValidate$1(GtfsFeedLoader.java:161)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829) Is it related somehow to the abovementioned fix? I don't see any calendars with all days set to "0" in my data. |
Hi @tafflin, I found a possible root cause. Can you share the feed that you are testing to be able to reproduce the same issue on my side? Thanks. |
@davidgamez We process multiple feeds and just recently I discovered that some of them have issues when validating. One of issues I mentioned can be found when processing this feed: https://gtfs.pro/files/uran/improved-gtfs-dft-gtfs.zip. It's 400+ mb. |
Summary:
Fix ExpiredCalendarValidator throwing NoSuchElementException when checking a calendar with no days set to 1.
Expected behavior:
Checking a calendar.txt file where a row has no days set to 1 does not crash the validator.
Please make sure these boxes are checked before submitting your pull request - thanks!
gradle test
to make sure you didn't break anything