Skip to content

Xpp3DomWriter: reject a null dom with a named NullPointerException - #426

Merged
slachiewicz merged 1 commit into
masterfrom
agent/xpp3domwriter-null-check
Sep 10, 2026
Merged

slachiewicz merged 1 commit into
masterfrom
agent/xpp3domwriter-null-check

Conversation

@slachiewicz

Copy link
Copy Markdown
Member

Xpp3DomWriter.write dereferences dom immediately, so a null argument already fails with a bare NullPointerException and no indication of which argument was wrong. Objects.requireNonNull names it, and a test pins the behaviour.

The commit is Elliotte Rusty Harold's, cherry-picked from the fix/xpp3domwriter-null-dom branch he pushed here on 2026-07-01 and never opened as a PR. Authorship is preserved, and the code is unchanged. Opening it because the fix is finished and 3.5.0 is close; happy to hand it back if he would rather carry it himself.

No behaviour change beyond the message: the call threw NullPointerException before and still does. It also adds Xpp3DomWriterTest, which the class had none of.

Xpp3DomWriter is deprecated in 3.5.0, so this is a diagnostics improvement on a class on its way out rather than new investment.

Verified: mvn -B verify on JDK 17 -> Tests run: 788, Failures: 0, Errors: 0. Spotless clean.

This change was created with AI assistance.

@slachiewicz slachiewicz added the java Pull requests that update Java code label Sep 10, 2026
@slachiewicz
slachiewicz marked this pull request as ready for review September 10, 2026 08:31
@slachiewicz
slachiewicz merged commit 2fbd88f into master Sep 10, 2026
7 checks passed
@slachiewicz
slachiewicz deleted the agent/xpp3domwriter-null-check branch September 10, 2026 08:32
@github-actions github-actions Bot added this to the 3.5.0 milestone Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

java Pull requests that update Java code maintenance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants