You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "elharo (via GitHub)" <gi...@apache.org> on 2026/07/01 13:32:02 UTC
[PR] Xpp3DomWriter: add explicit null check for dom parameter [maven-shared-utils]
elharo opened a new pull request, #397:
URL: https://github.com/apache/maven-shared-utils/pull/397
All public `write` methods accept an `Xpp3Dom dom` parameter without null checks. Passing `null` throws a `NullPointerException` deep inside the delegation chain (at `dom.getName()` in the `write(XMLWriter, Xpp3Dom, boolean)` method), producing a confusing stack trace for callers.
**Fix:** Added `Objects.requireNonNull(dom, "dom must not be null")` at the entry to the shared `write(XMLWriter, Xpp3Dom, boolean)` method, so callers get a clear message immediately.
Fixes https://github.com/apache/maven-shared-utils/issues/396
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Xpp3DomWriter: add explicit null check for dom parameter [maven-shared-utils]
Posted by "elharo (via GitHub)" <gi...@apache.org>.
elharo closed pull request #397: Xpp3DomWriter: add explicit null check for dom parameter
URL: https://github.com/apache/maven-shared-utils/pull/397
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Xpp3DomWriter: add explicit null check for dom parameter [maven-shared-utils]
Posted by "desruisseaux (via GitHub)" <gi...@apache.org>.
desruisseaux commented on code in PR #397:
URL: https://github.com/apache/maven-shared-utils/pull/397#discussion_r3506716139
##########
src/main/java/org/apache/maven/shared/utils/xml/Xpp3DomWriter.java:
##########
@@ -62,6 +63,7 @@ public static void write(XMLWriter xmlWriter, Xpp3Dom dom) throws IOException {
* @throws IOException if writing fails
*/
public static void write(XMLWriter xmlWriter, Xpp3Dom dom, boolean escape) throws IOException {
+ Objects.requireNonNull(dom, "dom must not be null");
Review Comment:
Is it really solving the problem described in the issue? The next line is `dom.getName()`, therefore a `NullPointerException` would happen there anyway. The stack trace produced by `Objects` will be even deeper (a little bit) than the stack trace produced by the `NullPointerException` on the next line.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Xpp3DomWriter: add explicit null check for dom parameter [maven-shared-utils]
Posted by "elharo (via GitHub)" <gi...@apache.org>.
elharo commented on code in PR #397:
URL: https://github.com/apache/maven-shared-utils/pull/397#discussion_r3507092600
##########
src/main/java/org/apache/maven/shared/utils/xml/Xpp3DomWriter.java:
##########
@@ -62,6 +63,7 @@ public static void write(XMLWriter xmlWriter, Xpp3Dom dom) throws IOException {
* @throws IOException if writing fails
*/
public static void write(XMLWriter xmlWriter, Xpp3Dom dom, boolean escape) throws IOException {
+ Objects.requireNonNull(dom, "dom must not be null");
Review Comment:
makese sense. thanks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org