From 33c4122583006f8edbc9acd97cdca12386a57473 Mon Sep 17 00:00:00 2001 From: Titus Fortner Date: Thu, 5 Oct 2023 17:12:49 -0500 Subject: [PATCH] [java] ensure proper error message gets logged (#12853) * [java] ensure proper error message gets logged * check getCause for null instead of getMessage --- java/src/org/openqa/selenium/remote/http/WebSocket.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/java/src/org/openqa/selenium/remote/http/WebSocket.java b/java/src/org/openqa/selenium/remote/http/WebSocket.java index aabfe06d57da6..e49ba03b924fa 100644 --- a/java/src/org/openqa/selenium/remote/http/WebSocket.java +++ b/java/src/org/openqa/selenium/remote/http/WebSocket.java @@ -64,7 +64,11 @@ default void onText(CharSequence data) { } default void onError(Throwable cause) { - LOG.log(WARNING, cause.getMessage(), cause); + String message = cause.getMessage(); + if (message == null && cause.getCause() != null) { + message = cause.getCause().getMessage(); + } + LOG.log(WARNING, message, cause); } } }