From 75b1d8ce1326552bdbc421228b09c79e52e87100 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Mon, 8 Apr 2019 23:06:21 +0200 Subject: [PATCH] Add AbstractError.Builder.setDescriptiveEnText(String, Exception) --- .../org/jivesoftware/smack/packet/AbstractError.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/AbstractError.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/AbstractError.java index ece30af7b..e75e7a0e9 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/AbstractError.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/AbstractError.java @@ -23,6 +23,7 @@ import java.util.List; import java.util.Locale; import java.util.Map; +import org.jivesoftware.smack.util.ExceptionUtil; import org.jivesoftware.smack.util.Objects; import org.jivesoftware.smack.util.PacketUtil; import org.jivesoftware.smack.util.XmlStringBuilder; @@ -150,6 +151,17 @@ public class AbstractError { return getThis(); } + public B setDescriptiveEnText(String descriptiveEnText, Exception exception) { + StringBuilder sb = new StringBuilder(512); + sb.append(descriptiveEnText) + .append('\n'); + + String stacktrace = ExceptionUtil.getStackTrace(exception); + sb.append(stacktrace); + + return setDescriptiveEnText(sb.toString()); + } + public B setTextNamespace(String textNamespace) { this.textNamespace = textNamespace; return getThis();