mirror of
https://github.com/theonedev/onedev.git
synced 2025-12-08 18:26:30 +00:00
fix: Hidden parameters cause build failure (OD-2560)
This commit is contained in:
parent
a77172ef43
commit
0defe8b62a
@ -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);
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user