diff --git a/plugin/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsThreadDump.java b/plugin/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsThreadDump.java index 8d5ac2c0a..e3b0c3682 100644 --- a/plugin/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsThreadDump.java +++ b/plugin/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsThreadDump.java @@ -24,6 +24,10 @@ */ public final class CpsThreadDump { + /** + * Whether this is an actual list of threads, or just some special text such as a list of pickles. + */ + public final boolean valid; private final List threads = new ArrayList<>(); public static final class ThreadInfo { @@ -103,7 +107,8 @@ public String toString() { /** * Use one of the {@link #from(CpsThreadGroup)} method. */ - private CpsThreadDump() { + private CpsThreadDump(boolean valid) { + this.valid = valid; } public List getThreads() { @@ -128,7 +133,7 @@ public String toString() { } public static CpsThreadDump from(Throwable t) { - CpsThreadDump td = new CpsThreadDump(); + CpsThreadDump td = new CpsThreadDump(false); td.threads.add(new ThreadInfo(t)); return td;} @@ -140,7 +145,7 @@ public static CpsThreadDump from(CpsThreadGroup g) { l.add(t); } - CpsThreadDump td = new CpsThreadDump(); + CpsThreadDump td = new CpsThreadDump(true); for (List e : m.values()) td.threads.add(new ThreadInfo(e)); return td; @@ -165,7 +170,7 @@ public static CpsThreadDump from(CpsThreadGroup g) { /** * Constant that indicates everything is done and no thread is alive. */ - public static final CpsThreadDump EMPTY = new CpsThreadDump(); + public static final CpsThreadDump EMPTY = new CpsThreadDump(false); @Deprecated public static final CpsThreadDump UNKNOWN = fromText("Program state is not yet known"); diff --git a/plugin/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsThreadDumpAction.java b/plugin/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsThreadDumpAction.java index 5b03367f3..049134c67 100644 --- a/plugin/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsThreadDumpAction.java +++ b/plugin/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsThreadDumpAction.java @@ -60,8 +60,8 @@ public String getParentUrl() throws IOException { return execution.getThreadDump(); } - public String getThreadDump() { - return execution.getThreadDump().toString(); + public CpsThreadDump getThreadDump() { + return execution.getThreadDump(); } @WebMethod(name = "program.xml") public void doProgramDotXml(StaplerRequest req, StaplerResponse rsp) throws Exception { diff --git a/plugin/src/main/resources/org/jenkinsci/plugins/workflow/cps/CpsThreadDumpAction/index.jelly b/plugin/src/main/resources/org/jenkinsci/plugins/workflow/cps/CpsThreadDumpAction/index.jelly index fa4fada79..8c672f070 100644 --- a/plugin/src/main/resources/org/jenkinsci/plugins/workflow/cps/CpsThreadDumpAction/index.jelly +++ b/plugin/src/main/resources/org/jenkinsci/plugins/workflow/cps/CpsThreadDumpAction/index.jelly @@ -28,19 +28,22 @@ +

${%Thread Dump} - +

-        ${td}
+        ${tds}
       
- - Serialized program state - + + + Serialized program state + +