Alon Bar-Lev has posted comments on this change. Change subject: uutils: added new cli parser ......................................................................
Patch Set 12: (3 comments) https://gerrit.ovirt.org/#/c/40157/12/backend/manager/modules/uutils/src/main/java/org/ovirt/engine/core/uutils/cli/parser/ArgumentsParser.java File backend/manager/modules/uutils/src/main/java/org/ovirt/engine/core/uutils/cli/parser/ArgumentsParser.java: Line 152: Line 153: /** Line 154: * Map which stores parsed converted arguments. Line 155: */ Line 156: private Map<String, Argument> arguments = new HashMap<>(); > Please always initialize instance attributes in constructor why? Line 157: Line 158: /** Line 159: * Set of mandatory arguments to check if user specified all of them. Line 160: */ Line 221: public boolean parse(List<String> args) { Line 222: parsedArgs = new HashMap<>(); Line 223: errors = new ArrayList<>(); Line 224: Line 225: while(!args.isEmpty()) { > Usually it's a bad behavior to modify Collection provided by caller. Wouldn no, as the other arguments are left for farther parsing. Line 226: String arg = args.get(0); Line 227: if(!arg.startsWith(LONG_PREFIX)) { Line 228: break; Line 229: } Line 246: value == null && Line 247: ( Line 248: argument.getType() == Argument.Type.OPTIONAL_ARGUMENT || Line 249: argument.getType() == Argument.Type.HAS_ARGUMENT Line 250: ) > I would still prefer this condition: it is not as it is not obvious what other values there are. Line 251: ) { Line 252: if(args.size() > 0) { Line 253: value = args.get(0); Line 254: if (value.startsWith(LONG_PREFIX)) { -- To view, visit https://gerrit.ovirt.org/40157 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I00042b669e19293641579582223e7ca40717132d Gerrit-PatchSet: 12 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Ondra Machacek <omach...@redhat.com> Gerrit-Reviewer: Alon Bar-Lev <alo...@redhat.com> Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Martin Peřina <mper...@redhat.com> Gerrit-Reviewer: Mooli Tayer <mta...@redhat.com> Gerrit-Reviewer: Ondra Machacek <omach...@redhat.com> Gerrit-Reviewer: Oved Ourfali <oourf...@redhat.com> Gerrit-Reviewer: automat...@ovirt.org Gerrit-Reviewer: mooli tayer <mta...@redhat.com> Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches