From 46a28ccd99226e062c87381cff21ff884ea66a3a Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Thu, 23 May 2024 11:15:26 -0700 Subject: [PATCH] Allow for deeply nested causes --- .../file_parameters/AbstractFileParameterDefinition.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/jenkins/plugins/file_parameters/AbstractFileParameterDefinition.java b/src/main/java/io/jenkins/plugins/file_parameters/AbstractFileParameterDefinition.java index 55f25a1..b3c3092 100644 --- a/src/main/java/io/jenkins/plugins/file_parameters/AbstractFileParameterDefinition.java +++ b/src/main/java/io/jenkins/plugins/file_parameters/AbstractFileParameterDefinition.java @@ -24,6 +24,7 @@ package io.jenkins.plugins.file_parameters; +import com.google.common.base.Throwables; import hudson.cli.CLICommand; import hudson.model.Failure; import hudson.model.ParameterDefinition; @@ -69,8 +70,7 @@ protected Object readResolve() { src = req.getFileItem(getName()); } catch (Exception x) { // TODO simplify when we drop support for Commons FileUpload 1.x - String simpleName = - x.getCause() != null ? x.getCause().getClass().getSimpleName() : null; + String simpleName = Throwables.getRootCause(x).getClass().getSimpleName(); if ("InvalidContentTypeException".equals(simpleName) /* Commons FileUpload 1.x */ || "FileUploadContentTypeException".equals(simpleName)) /* Commons FileUpload 2.x */ { src = null;