Skip to content

Commit 92aadc9

Browse files
committed
CpsFlowExecution: restore the multi-catch for "RuntimeException | Error"
Notably, the latter is a Throwable but not an Exception so e.g. LinkageError might be not handled. Signed-off-by: Jim Klimov <[email protected]>
1 parent 0fc23a5 commit 92aadc9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

plugin/src/main/java/org/jenkinsci/plugins/workflow/cps/CpsFlowExecution.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,15 +639,17 @@ private CpsScript parseScript() throws IOException {
639639
for (Entry<String, String> e : loadedScripts.entrySet()) {
640640
shell.reparse(e.getKey(), e.getValue());
641641
}
642-
} catch (Exception x) {
642+
} catch (RuntimeException | Error x) {
643643
// Suspected groovyjarjarasm.asm.MethodTooLargeException or a
644644
// org.codehaus.groovy.control.MultipleCompilationErrorsException
645645
// whose collection of errors refers to MethodTooLargeException.
646646
// Per review comments, we do not want to statically compile a
647647
// dependency on the groovyjarjarasm.asm.MethodTooLargeException
648648
// internals, so gauge hitting it via String name comparisons.
649649
// Other cases may be (subclasses of) RuntimeException or Error.
650-
Exception mtlEx = null;
650+
// Note that both MultipleCompilationErrorsException and
651+
// MethodTooLargeException are descended from RuntimeException.
652+
Throwable mtlEx = null;
651653
int ecCount = 0;
652654

653655
// Clean up first

0 commit comments

Comments
 (0)