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
1 changed files with 12 additions and 0 deletions

View File

@ -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();