?
=?ISO-8859-15?Q?Juli=E1n?= Albo
"File not found" and "Null pointer" exceptions which are common in java
are definitly not exceptional conditions - file not found is common and
"null pointer" should be handled as an error.
I think file not found is almost always an exceptional condition, no matter
how frequently it happens. In an interactive program the response to that
condition will be to inform the user, in a non interactive usually to abort
or write to some error log. These actions are not part of the main flow of
the program, nor suffer any harm for the minimal delay the exception
handling can have even with the compilers worse in this aspect.
Surely one can imagine a directory reading utility that tries to open all
possible file names, and returns the names in which the open succeed. Here
a delay caused by exception handling if the "file not found" condition is
handled that way can be significant. But in this case, and other more
realistic of the same type, put the blame in the inadequate algorithm used,
not in the exception handling.
A null pointer is like have a 0 value in an integer: It can be exceptional,
a symptom of a serious flaw or a perfectly normal condition, depending of
what each concrete functions than handle pointers expects.
The same thing with any other general condition. A 'end of file reached' is
a perfectly normal event when reading a text file, but is abnormal when
reading a fixed size field in a binary file with well defined format.