Print

Print


> Java requires you add certain exception handlers simply to compile, and

It may be even worse than that.  Say you discover that a certain utility
method passes out invalid data if the file containing the valid data
doesn't exist.  This data causes an index out of range far downstream from
the actual error.

The sensible solution, of course, is to check for the file's existence.
But if missing, how do you recover?  Only the unit that made the call has
sufficient information to handle the fact that the file it asked for is
missing.  So we should throw fileNotFound, right?

Only that means you have to track down all the clients of this method and
add the new 'throws' clause.  Or write a less than optimum catcher in the
utility method.

Which fix do you suppose they'll use, the fast one or the right one?

--
Wes Groleau
http://freepages.rootsweb.com/~wgroleau