提交 d5d8463e 编写于 作者: O Oleg Nenashev

Merge pull request #1468 from synopsys-arc-oss/JENKINS-25734

[JENKINS-25734] - Prevent NPE in Executor/causeOfDeath page on "expected thread death"
......@@ -152,6 +152,7 @@ import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import hudson.util.RunList;
import java.util.concurrent.atomic.AtomicLong;
import javax.annotation.CheckForNull;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
......@@ -1392,7 +1393,17 @@ public class Functions {
return value!=null ? value : defaultValue;
}
public static String printThrowable(Throwable t) {
/**
* Gets info about the specified {@link Throwable}.
* @param t Input {@link Throwable}
* @return If {@link Throwable} is not null, a summary info with the
* stacktrace will be returned. Otherwise, the method returns a default
* "No exception details" string.
*/
public static String printThrowable(@CheckForNull Throwable t) {
if (t == null) {
return Messages.Functions_NoExceptionDetails();
}
StringWriter sw = new StringWriter();
t.printStackTrace(new PrintWriter(sw));
return sw.toString();
......
......@@ -627,7 +627,7 @@ public class Executor extends Thread implements ModelObject {
* @return null if the death is expected death or the thread {@link #isActive}.
* @since 1.142
*/
public Throwable getCauseOfDeath() {
public @CheckForNull Throwable getCauseOfDeath() {
return causeOfDeath;
}
......
......@@ -67,4 +67,6 @@ AboutJenkins.Description=See the version and license information.
ProxyConfiguration.TestUrlRequired=Test URL is required.
ProxyConfiguration.FailedToConnectViaProxy=Failed to connect to {0}.
ProxyConfiguration.FailedToConnect=Failed to connect to {0} (code {1}).
ProxyConfiguration.Success=Success
\ No newline at end of file
ProxyConfiguration.Success=Success
Functions.NoExceptionDetails=No Exception details
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册