[RFA/JDWP] Transport factory

Keith Seitz keiths@redhat.com
Fri Jun 3 22:15:00 GMT 2005


On Fri, 2005-06-03 at 14:59 -0600, Tom Tromey wrote:
> >>>>> "Keith" == Keith Seitz <keiths@redhat.com> writes:
> 
> Keith> +    IllegalArgumentException e;
> Keith> +    e = new IllegalArgumentException ("transport \"" + name + "\" not found");
> Keith> +    throw new TransportException (e);
> 
> It is more ordinary to just make an IllegalArgumentException and throw
> it.  Does this need to be caught somewhere else in the JDWP code
> somehow?  If so, then wrapping an IllegalArgumentException seems a bit
> weird...

TransportException is thrown at runtime, but I wouldn't classify it as a
"runtime exception", i.e., a programming error (a la
IllegalArgumentException).

It is used to trap various problems which may result because the user
mis-specified the transport or the transport was unable to initialize.
So it generically wraps things like IOException, UnknownHostException,
timeout exceptions, and who knows what else might happen while
initializing the transport.

By having one exception thrown by the lower layers, the upper layers
don't have to catch everything under the sun. Imagine a real
RuntimeException occuring, but getting swallowed by a catch somewhere
because the upper levels of initialization had to catch 400 different
exceptions (the union of all possible exceptions thrown by all
transports).

That's the idea, anyway. Perhaps I am being too nit-picky about real
runtime exceptions (aka "programming errors") and user errors which
result in the same exceptions.

Perhaps I should just whack the illegalargumentexception and just use
the string used to construct the TransportException directly?

Let me know what you'd like me to do.

Keith



More information about the Java-patches mailing list