Name: gm110360 Date: 09/21/2001
java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)
The various listFiles methods of File all have the following annoying feature:
they may possibly return null if an I/O error occurs.
This behavior of listFiles is very inconvenient, because it means that not only
must I have code that handles IOExceptions (which is fine), but I also have to
do additional null checks on the result.
Better behavior would be that if an I/O error occurs, than an IOException always
gets thrown. You should not use a distinguished return value to sometimes
indicate errors, and then also other times throw Exceptions!
(Note: the other time that null can be retuned from listFiles is if the path is
not a directory. It would probably be better behavior to always thru an
Exception in this case too instead of returning null.)
(Review ID: 132377)
======================================================================