From 27ff37fa98d82203b9bf2a9e7404b5967990bf9d Mon Sep 17 00:00:00 2001 From: Ingo Bauersachs Date: Sun, 17 Oct 2021 16:06:41 +0200 Subject: [PATCH] Add getter for the stanza associated with the exception Fixes SMACK-916 --- .../java/org/jivesoftware/smack/XMPPException.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/XMPPException.java b/smack-core/src/main/java/org/jivesoftware/smack/XMPPException.java index ce4c0a4f0..f7235fb48 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/XMPPException.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/XMPPException.java @@ -120,6 +120,16 @@ public abstract class XMPPException extends Exception { return error; } + /** + * Gets the stanza associated with this exception. + * + * @return the stanza from which this exception was created or {@code null} if the exception is not from a + * stanza. + */ + public Stanza getStanza() { + return stanza; + } + /** * Get the request which triggered the error response causing this exception. *