fix(parser): accept report modifiers before the delivery time - #833
Open
f-loris wants to merge 1 commit into
Open
fix(parser): accept report modifiers before the delivery time#833f-loris wants to merge 1 commit into
f-loris wants to merge 1 commit into
Conversation
A correction indicator is legal both between the report type and the station
("METAR COR LFPG 081130Z") and between the station and the delivery time
("MRLB COR 071700Z"), the latter being the form NOAA publishes. Both were
rejected because parseIdentification expected the station and the delivery
time at fixed offsets.
Reuse parseFlags for the tokens preceding the delivery time, so these reports
parse and isCorrected() reports them as corrected, consistent with a COR that
follows the delivery time and is already handled by the body of the message.
Flag skipping stays disabled at index 0, where only a report type or a station
can appear and where AUTO would otherwise shadow a four-letter station.
|
Please check on sonarcloud https://sonarcloud.io/project/pull_requests_list?id=io.github.mivek%3AmetarParser that the PR does not add any issue. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes parsing of a
CORcorrection indicator placed before the delivery time group.parseIdentificationexpected the station at a fixed offset after the optionalMETAR/SPECIprefix, and the delivery time immediately after the station. Any modifier in between was parsed as a station or as a time and threw aParseException.Two legal placements were affected:
The library already models this:
Flag.CORandisCorrected()exist, andparseFlagshandles aCORthat follows the delivery time. This change reusesparseFlagsfor the tokens preceding the delivery time, so all three placements behave the same andisCorrected()is set consistently. No new API.Flag skipping is disabled at index 0, where only a report type or a station can appear -- otherwise
AUTO, which is both aFlagand a four-letter token matching the station pattern, would be consumed as a modifier.Tests
7 added to
MetarParserTestcovering the threeCORplacements, the uncorrected baseline, both truncated-message error paths, and theAUTO-at-index-0 guard.mvn verifygreen: 661 tests, Checkstyle, SpotBugs and JaCoCo gates all passing.