Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug #38228 [Yaml Parser] Fix edge cases when parsing multiple documen…
…ts (digilist) This PR was merged into the 3.4 branch. Discussion ---------- [Yaml Parser] Fix edge cases when parsing multiple documents | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | I identified some edge cases when parsing multiple YAML documents with the same parser instance, because the totalNumberOfLines was not reset and so any subsequent parsing considered the number of lines of the first document. Consider this document: ```yaml a: b: | row row2 c: d ``` Normally, `a.b` would be parsed as `row\nrow2\n`. But if the parser parsed a shorter document before, the `\n` after row2 was missing, as the parser considered it as the end of the file (that's why the `c: d` at the end is important). So this fix resets the `totalNumberOfLines` in the YAML parser to `null` so that any subsequent parsing will initialize the value for the new document and does not use the file length of the first parsed document. I stumbled upon this because of a flickering unit test that was using the translation component. Sometimes the translated string contained a trailing `\n` and sometimes not. In the end it was based on this bug, as the translation files were not loaded in the same order every time (not really sure why. It's somehow related to the cache state, but even with a warm cache it was not totally deterministic). Commits ------- 012ee4fa59 [Yaml Parser] Fix edge cases when parsing multiple documents
- Loading branch information