From 69749119ac14a73c06ecf2e328f0e49779964799 Mon Sep 17 00:00:00 2001 From: Guus der Kinderen Date: Thu, 20 Jul 2023 10:52:45 +0200 Subject: [PATCH] OF-2611: Add context to StreamError when no message is provided. --- .../java/org/jivesoftware/util/StreamErrorException.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/xmppserver/src/main/java/org/jivesoftware/util/StreamErrorException.java b/xmppserver/src/main/java/org/jivesoftware/util/StreamErrorException.java index b1b2fb3d0c..4fadab9ced 100644 --- a/xmppserver/src/main/java/org/jivesoftware/util/StreamErrorException.java +++ b/xmppserver/src/main/java/org/jivesoftware/util/StreamErrorException.java @@ -45,7 +45,7 @@ public StreamErrorException(StreamError.Condition condition, String message, Thr public StreamErrorException(StreamError.Condition condition, Throwable cause) { - super(cause); + super(condition.name(), cause); this.streamError = new StreamError(condition); } @@ -57,6 +57,7 @@ public StreamErrorException(StreamError.Condition condition, String message, Thr public StreamErrorException(StreamError streamError) { + super(streamError != null && !streamError.getText().isEmpty() ? streamError.getText() : null); this.streamError = streamError; } @@ -74,7 +75,7 @@ public StreamErrorException(StreamError streamError, String message, Throwable c public StreamErrorException(StreamError streamError, Throwable cause) { - super(cause); + super(streamError != null && !streamError.getText().isEmpty() ? streamError.getText() : null, cause); this.streamError = streamError; }