1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-22 06:12:05 +01:00

Add AbstractError.Builder.setDescriptiveEnText(String, Exception)

This commit is contained in:
Florian Schmaus 2019-04-08 23:06:21 +02:00
parent 1122bf394c
commit 75b1d8ce13

View file

@ -23,6 +23,7 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import org.jivesoftware.smack.util.ExceptionUtil;
import org.jivesoftware.smack.util.Objects; import org.jivesoftware.smack.util.Objects;
import org.jivesoftware.smack.util.PacketUtil; import org.jivesoftware.smack.util.PacketUtil;
import org.jivesoftware.smack.util.XmlStringBuilder; import org.jivesoftware.smack.util.XmlStringBuilder;
@ -150,6 +151,17 @@ public class AbstractError {
return getThis(); 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) { public B setTextNamespace(String textNamespace) {
this.textNamespace = textNamespace; this.textNamespace = textNamespace;
return getThis(); return getThis();