Skip to content

The Unified and Autonomous Development Platform

fix: Hidden parameters cause build failure (OD-2560)

Robin Shen0defe8b62a64
diff --git a/server-core/src/main/java/io/onedev/server/util/interpolative/VariableInterpolator.java b/server-core/src/main/java/io/onedev/server/util/interpolative/VariableInterpolator.java
index ca1fd726af..233197ca13 100644
--- a/server-core/src/main/java/io/onedev/server/util/interpolative/VariableInterpolator.java
+++ b/server-core/src/main/java/io/onedev/server/util/interpolative/VariableInterpolator.java
@@ -64,18 +64,14 @@ public class VariableInterpolator {
for (Entry<String, Input> entry : paramCombination.getParamInputs().entrySet()) {
if (paramName.equals(entry.getKey())) {
- if (paramCombination.isParamVisible(paramName)) {
- String paramType = entry.getValue().getType();
- List<String> paramValues = new ArrayList<>();
- for (String value : entry.getValue().getValues()) {
- if (paramType.equals(ParamSpec.SECRET))
- value = build.getJobAuthorizationContext().getSecretValue(value);
- paramValues.add(value);
- }
- return StringUtils.join(paramValues, ",");
- } else {
- throw new ExplicitException("Invisible param: " + paramName);
+ String paramType = entry.getValue().getType();
+ List<String> paramValues = new ArrayList<>();
+ for (String value : entry.getValue().getValues()) {
+ if (paramType.equals(ParamSpec.SECRET))
+ value = build.getJobAuthorizationContext().getSecretValue(value);
+ paramValues.add(value);
}
+ return StringUtils.join(paramValues, ",");
}
}
throw new ExplicitException("Undefined param: " + paramName);
diff --git a/server-core/src/main/java/org/hibernate/validator/internal/engine/ValidatorImpl.java b/server-core/src/main/java/org/hibernate/validator/internal/engine/ValidatorImpl.java
index 8d8c28acb4..70dd48b6d7 100644
--- a/server-core/src/main/java/org/hibernate/validator/internal/engine/ValidatorImpl.java
+++ b/server-core/src/main/java/org/hibernate/validator/internal/engine/ValidatorImpl.java
@@ -86,6 +86,7 @@ import io.onedev.server.util.BeanUtils;
import io.onedev.server.util.DependsOnUtils;
import io.onedev.server.util.EditContext;
import io.onedev.server.util.ReflectionUtils;
+import io.onedev.server.web.editable.EditableUtils;
/**
* The main Bean Validation class. This is the core processing class of Hibernate Validator.
@@ -1345,12 +1346,19 @@ public class ValidatorImpl implements Validator, ExecutableValidator {
public Object getInputValue(String name) {
var getter = BeanUtils.findGetter(bean.getClass(), name);
if (getter == null) {
- throw new ExplicitException("Getter not found for property: " + name);
+ for (var eachGetter: BeanUtils.findGetters(bean.getClass())) {
+ if (EditableUtils.getDisplayName(eachGetter).equals(name)) {
+ getter = eachGetter;
+ break;
+ }
+ }
+ if (getter == null)
+ throw new ExplicitException("Getter not found for property: " + name);
}
try {
return getter.invoke(bean);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
- throw new ExplicitException("Error invoking getter for property: " + dependsOn.property(), e);
+ throw new ExplicitException("Error invoking getter for property: " + name, e);
}
}
});