Functions.printStackTrace utility method.

This commit is contained in:
Jesse Glick committed 2016-12-12 17:56:24 -05:00
1 parent 24aa20635d
commit 76aa0727f0
32 files changed
+73 -52

No files matched your search

+21
View File
@@ -156,6 +156,7 @@ import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import hudson.model.PasswordParameterDefinition;
import hudson.util.RunList;
import java.io.PrintStream;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.atomic.AtomicLong;
@@ -1505,6 +1506,26 @@ public class Functions {
}
}
/**
* Like {@link Throwable#printStackTrace(PrintWriter)} but using {@link #printThrowable} format.
* @param t an exception to print
* @param pw the log
* @since FIXME
*/
public static void printStackTrace(@CheckForNull Throwable t, @Nonnull PrintWriter pw) {
pw.println(printThrowable(t).trim());
}
/**
* Like {@link Throwable#printStackTrace(PrintStream)} but using {@link #printThrowable} format.
* @param t an exception to print
* @param ps the log
* @since FIXME
*/
public static void printStackTrace(@CheckForNull Throwable t, @Nonnull PrintStream ps) {
ps.println(printThrowable(t).trim());
}
/**
* Counts the number of rows needed for textarea to fit the content.
* Minimum 5 rows.