JavaDoc: NPE in java.net.http.HttpHeaders
Michel Trudeau
michel.trudeau at oracle.com
Mon May 5 20:19:28 UTC 2025
From: core-libs-dev <core-libs-dev-retn at openjdk.org> on behalf of Steffen Nießing <zuniquex at protonmail.com>
Date: Monday, May 5, 2025 at 1:05 PM
To: core-libs-dev at openjdk.org <core-libs-dev at openjdk.org>
Subject: JavaDoc: NPE in java.net.http.HttpHeaders
Hello,
recently I've discovered that the JavaDoc of the instance methods of java.net.http.HttpHeaders lacks the throws declarations for NullPointerExceptions. The static creator method `of` contains such a declaration. So the snippet `HttpHeaders.of(null, null)` is documented to throw an NPE, while the snippet `HttpHeaders.of(Map.of(), (k, v) -> true).firstValue(null)` currently isn't.
I'd propose to add the missing JavaDoc throws declarations to the #allValues(String), #firstValueAsLong(String) and #firstValue(String) methods as they all can throw an NPE through `requireNonNull(name);` in the allValues method.
If there's interest in this change, I'd appreciate if anyone would like to sponsor me on this one.
Cheers,
Steffen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/javadoc-dev/attachments/20250505/94a8269e/attachment.htm>
More information about the javadoc-dev
mailing list