Alon Bar-Lev has posted comments on this change.

Change subject: aaa: builtin: manage-domains: convert to new parameters parser
......................................................................


Patch Set 17:

(3 comments)

https://gerrit.ovirt.org/#/c/39972/17/backend/manager/modules/builtin-extensions/src/main/java/org/ovirt/engine/extensions/aaa/builtin/tools/ManageDomainsExecutor.java
File 
backend/manager/modules/builtin-extensions/src/main/java/org/ovirt/engine/extensions/aaa/builtin/tools/ManageDomainsExecutor.java:

Line 44:                 throw new 
ManageDomainsResult(ManageDomainsResultEnum.OK);
Line 45:             } else if ((Boolean)argMap.get("version")) {
Line 46:                 System.out.format("%s-%s (%s)%n", PACKAGE_NAME, 
PACKAGE_VERSION, PACKAGE_DISPLAY_NAME);
Line 47:                 throw new 
ManageDomainsResult(ManageDomainsResultEnum.OK);
Line 48:             } else if (!errors.isEmpty()) {
there is no need for the else if here as the sequence checks for parameters, 
usually best that if else sequence iterate single subject.

also I am unsure about the errors temp var requirement... but I leave it to you.

 if (!parser.getErrors().isEmpty()) {
      for (Throwable t : parser.getErrors()) {
      }
 }
Line 49:                 for (Throwable t : errors) {
Line 50:                     logger.error(t.getMessage());
Line 51:                     logger.debug(t.getMessage(), t);
Line 52:                 }


Line 51:                     logger.debug(t.getMessage(), t);
Line 52:                 }
Line 53:                 throw new ManageDomainsResult(
Line 54:                     ManageDomainsResultEnum.ARGUMENT_PARSING_ERROR,
Line 55:                     errors.get(0).getMessage()
this is what displayed to user? if there is duplicate with the above 
logger.error? if not, we can also prepare a message with all errors, no?
Line 56:                 );
Line 57:             }
Line 58:             if (cmdArgs.size() < 1) {
Line 59:                 throw new ManageDomainsResult(


Line 81:             if(!util.isValidAction()) {
Line 82:                 throw new 
ManageDomainsResult(ManageDomainsResultEnum.INVALID_ACTION, action);
Line 83:             }
Line 84: 
Line 85:             if ((Boolean)argMap.get("help")) {
how come --help is valid in this case? won't it return an error as in the above 
pattern?
Line 86:                 System.out.format(
Line 87:                     "usage: %s",
Line 88:                     parser.getUsage().replace("@PROGRAM_NAME@", 
PROGRAM_NAME)
Line 89:                 );


-- 
To view, visit https://gerrit.ovirt.org/39972
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I983b60824e31f279df0fe11c8adeb34b16f56e6a
Gerrit-PatchSet: 17
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Ondra Machacek <[email protected]>
Gerrit-Reviewer: Alon Bar-Lev <[email protected]>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Martin PeÅ™ina <[email protected]>
Gerrit-Reviewer: Ondra Machacek <[email protected]>
Gerrit-Reviewer: Oved Ourfali <[email protected]>
Gerrit-Reviewer: [email protected]
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to