RFR: 8358526: Clarify behavior of java.awt.HeadlessException constructed with no-args
Harshitha Onkar
honkar at openjdk.org
Fri Jun 20 22:25:35 UTC 2025
On Wed, 18 Jun 2025 17:57:26 GMT, Phil Race <prr at openjdk.org> wrote:
> Clarify the behaviour of new HeadlessException().getMessage()
> The spec. is updated to be clear that empty means null, not an empty string.
test/jdk/java/awt/Headless/HeadlessExceptionTest.java line 37:
> 35: public static void main (String[] args) {
> 36: String nullmsg = new HeadlessException().getMessage();
> 37: String emptymsg = new HeadlessException("").getMessage();
@prrace I was thinking of a case which would actually throw HeadlessException when run with `Djava.awt.headless=true` such as creating a frame or robot but the exception msg can be null or default message from GraphicsEnvironment so making it difficult to validate on different platforms. The current test works well to validate both empty and null message.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25881#discussion_r2159723867
More information about the client-libs-dev
mailing list