chore(mzml): annotate StaxMzMLParser BOM/prolog errors (Q8)#19
Open
chore(mzml): annotate StaxMzMLParser BOM/prolog errors (Q8)#19
Conversation
…e context (Q8) The Stax XML parser raises terse "ParseError in XML prolog" exceptions when an mzML file has a byte-order mark or malformed encoding declaration — a recurring onboarding failure reported in thomasp85/MSGFplus#8. Users see the message but not the fix. Wraps both parse entry points (buildIndex, preloadAllSpectra) in catches that: - preserve the original XMLStreamException as the cause - prepend the full mzML file path and the parse phase - when the underlying message looks like a BOM / prolog / encoding failure, point the user at ThermoRawFileParser / MSConvert and docs/Troubleshooting.md with a concrete shell command to detect a BOM (`head -c 3 file.mzML | xxd`) No behaviour change for well-formed mzML: annotate() is only reached on an exception, and the wrapped message still includes the original parser error verbatim so tooling that matches on Stax substrings keeps working. Tests: TestStaxMzMLParserErrorContext (2 cases) feeds BOM-prefixed and garbage-prolog mzML to the constructor and verifies the wrapped message is emitted. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Summary
The Stax XML parser raises terse
ParseError in XML prologexceptions when an mzML file carries a UTF-8 BOM or a malformed encoding declaration. This is a recurring onboarding failure mode (see thomasp85/MSGFplus#8) — users see the error but not the fix.This PR wraps the two Stax parse entry points in
StaxMzMLParser.java(buildIndexandpreloadAllSpectra) with a helperannotate(XMLStreamException, phase)that:index/preload)docs/Troubleshooting.md, including a concrete shell recipe to detect a BOM (head -c 3 file.mzML | xxd).No behaviour change for well-formed mzML —
annotateis only reached on an exception.Test plan
mvn -B verify— 159 tests pass (was 141 ondev; +2 new Q8 cases — total depends on merge order with PR chore(reliability): actionable centroiding error + missedCleavages test #17/feat: -minSpectraPerThread flag, MSGFLogger, and run-manifest sidecar (Q9/Q11/Q4) #18).TestStaxMzMLParserErrorContext(2 cases) — BOM-prefixed mzML and garbage-prolog mzML both trigger the annotated message path.XMLStreamExceptionkept as.getCause()and its message text is preserved verbatim in the wrapped message under"Underlying parser error: ...".Not in this PR
Follow-ups from the landscape review queue:
Pr(G|P)/Pr(G|O)columns) — own PR; touches scoring output.DirectPinWriter+-outputFormat pin) — own PR, 3–5 days.-Xmxpre-flight warning) — own PR on top of PR feat: -minSpectraPerThread flag, MSGFLogger, and run-manifest sidecar (Q9/Q11/Q4) #18'sMSGFLogger.🤖 Generated with Claude Code