dev@glassfish.java.net

asadmin output behaviour

From: Yamini K B <Yamini.Kb_at_Sun.COM>
Date: Tue, 08 Jun 2010 16:55:29 +0530
Hi,

I have a basic question on asadmin output. In v2.1, in case of error, the usage text is displayed before the actual error message. For example:

$ ./asadmin restore-domain domain1
Usage: restore-domain [--domaindir domain_directory] [--filename backup_filename]  [--description description] [--terse=false] [--echo=false] [--verbose=false] [domain_name]
The domain must be stopped before a restore-domain can be performed.

Whereas in v3.1, it is reversed:

$ ./asadmin restore-domain
Domain domain1 is not stopped.
Usage: asadmin [asadmin-utility-options] restore-domain [--filename <filename>]
    [--verbose[=<verbose(default:false)>]] [--description <description>]
    [--domaindir <domaindir>] [-?|--help[=<help(default:false)>]]
    [domain_name]
Command restore-domain failed.


Is this ok?

My second question is about CommandException and CommandValidationException. My understanding is that CommandValidationException should be thrown when there is an error while validating option or option values which basically indicates incorrect usage of command/command options. In the above command, doesn't CommandException seem more appropriate since its not a usage error?

Thanks,
-Yamini