Ravi Nori has posted comments on this change.
Change subject: engine : Validate parameter in canDoAction
......................................................................
Patch Set 7:
(4 comments)
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/utils/ParametersValidator.java
Line 24: }
Line 25: Map<Boolean, List<Parameter>> cmdParams =
getCommandParameters(obj);
Line 26:
Line 27: List<Parameter> paramNames = new ArrayList<Parameter>();
Line 28: for (Map.Entry<Parameter, Serializable> param :
paramsMap.entrySet()) {
Will add
Line 29: paramNames.add(param.getKey());
Line 30: }
Line 31:
Line 32: if (!paramNames.containsAll(cmdParams.get(false))) {
Line 29: paramNames.add(param.getKey());
Line 30: }
Line 31:
Line 32: if (!paramNames.containsAll(cmdParams.get(false))) {
Line 33: List<Parameter> copy = new ArrayList(cmdParams.get(true));
Has to be false
Line 34: copy.removeAll(paramNames);
Line 35: throw new
RequiredParametersMissingException(obj.getClass().getName(), copy);
Line 36: }
Line 37:
Line 43: for (Parameter param : paramNames) {
Line 44: if (buf.length() > 0) {
Line 45: buf.append(" ,");
Line 46: }
Line 47: buf.append(param.getName());
Will look into it
Line 48: }
Line 49: log.warnFormat("Unknown parameters {0} found in command.",
buf.toString());
Line 50: }
Line 51: }
Line 61: if (fieldAnnotation != null) {
Line 62: try {
Line 63:
cmdParams.get(fieldAnnotation.optional()).addAll(Arrays.asList((Parameter[])
field.get(cmd)));
Line 64: } catch (IllegalAccessException e) {
Line 65: log.warn("Unable to retrieve parameters for "
+ clz.getName() + "." + field.getName());
Can you elaborate
Line 66: }
Line 67: }
Line 68: }
Line 69: clz = clz.getSuperclass();
--
To view, visit http://gerrit.ovirt.org/21485
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I15566c9177da28b2d47bbb6018fbfb61defcf3da
Gerrit-PatchSet: 7
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Ravi Nori <[email protected]>
Gerrit-Reviewer: Alon Bar-Lev <[email protected]>
Gerrit-Reviewer: Ravi Nori <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches