Tom Tromey wrote:
> Artur> There is of course another problem with exception names - like
> Artur> java.io.FileNotFoundException, but I think that it is not
> Artur> possible to solve this, so people would need just to catch
> Artur> specific errors and replace their names by hand for display.
>
> Displaying the class name of the exception object should probably only
> be done by a quick-and-dirty application. A real application should
> handle this more intelligently.
I agree, but I'm afraid it is a bit too platform dependent. For example
when I try to open file for reading there is a lot of things that can go
wrong - no such file, no permission to do it, file locked by OS, some IO
error in hardware, out of file descriptors etc. I could handle it by
catching just IOException and reporting toString() version to user, so
he could take correct actions. I suppose that it is currently not a big
problem as there seems to be only one common IOException subclass -
FileNotFoundException, rest of critical conditions would have to go
through generic IOException anyway. I think that it is one of things
they want to correct in new io API.
Anyway, I think that duplicating type of exception in message string is
a way to go - so it would be
java.io.FileNotFoundException
File alfa/beta.txt not found.
(or in resource bundle
File {0} not found.
)
Artur