RFR: 8360045: StringTokenizer.hasMoreTokens() throws NPE after nextToken(null)

Alan Bateman alanb at openjdk.org
Tue Jun 24 06:22:29 UTC 2025


On Mon, 23 Jun 2025 21:21:44 GMT, ExE Boss <duke at openjdk.org> wrote:

> Note that as mentioned in the bug discussion, the same also occurs when doing `new StringTokenizer("some string", (String) null)`.

Right, and it's super weird, but seems to have been specified since JDK 5 to defer the NPE to later. I don't know if anything depends on that behavior but would be risky to change it now.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/25942#issuecomment-2998968220


More information about the core-libs-dev mailing list