admin@glassfish.java.net

Re: asadmin failures with exceptions

From: Byron Nevins <byron.nevins_at_oracle.com>
Date: Wed, 13 Oct 2010 16:16:49 -0700
I like #3.  It's a failure (hopefully unusual)  - so I don't mind seeing extra output.

I like your presentation MUCH better than messy long stack traces.  One line per nested Exception is clean and clear.

Then if AS_DEBUG is on -- dump the stack trace which might be handy for debugging...



On 10/12/2010 2:14 PM, Bill Shannon wrote:
In this issue:
https://glassfish.dev.java.net/issues/show_bug.cgi?id=13919
Joe suggests that more information should be included in the failure
message.  Rather than special-casing every possible failure cause,
perhaps it would be better to just print out the underlying exception?

When an asadmin command fails and throws CommandException, the asadmin
framework prints out the message from the exception as the reason for the
failure.  If I change it to also print out the "cause" embedded in that
exception, then I get this for the case that Joe describes:

CLI802 Synchronization failed for directory config
Command failed with exception: org.glassfish.api.admin.CommandException: No remote server named XXX. Is that the correct host name?

Yes, the CommandException embeds another CommandException with a more detailed
message.  And *that* exception embeds the original UnknownHostException.

Here's the options I'm considering to address this.  What do people think?

1. Fix *only* the synchronization code to include the message from the
   underlying exception in the failure message, e.g.,

    CLI802 Synchronization failed for directory config, caused by: org.glassfish.api.admin.CommandException: No remote server named XXX. Is that the correct host name?

   (Maybe you can't tell, but that's all on one line above.)

2. Change the asadmin framework to always include information about the
   cause of a failure as in my example above:

    CLI802 Synchronization failed for directory config
    Command failed with exception: org.glassfish.api.admin.CommandException: No remote server named XXX. Is that the correct host name?

   (That's two lines above.)

   My only concern with this is that we may start getting additional exception
   messages that are not relevant or not useful to the user.

2a. A variant of the above where the additional information is only printed
    if --terse is not set.

3. Like #2, but run down the entire chain of exceptions, printing each one,
   e.g.,

    CLI802 Synchronization failed for directory config
      Caused by: org.glassfish.api.admin.CommandException: No remote server named XXX. Is that the correct host name?
      Caused by: java.net.UnknownHostException: XXX

   (That's three lines.)

   This may be way too verbose and cryptic for regular users.


Comments?

---------------------------------------------------------------------
To unsubscribe, e-mail: admin-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: admin-help@glassfish.dev.java.net


-- 
Byron Nevins  -  Oracle Corporation
Home: 650-359-1290
Cell: 650-784-4123
Sierra: 209-295-2188