2008/10/2 Steve Ulrich <[EMAIL PROTECTED]>:
> I had similar discussions about the need of own exceptions, always with the
> same background: laziness and fear of complexity.
> The argumentation always reminds me on the Exceptions part of the mindprod
> "unmain"-Site:
> "Subclassing exceptions is for incompetents who know their code will fail.
> You can greatly simplify your program by having only a single try/catch in
> the entire application (in main) that calls System.exit()."
The use of a single FtpException goes in this direction.
The exception of the filesystemView methods should be designed for each method.
For example:
public interface FileSystemView {
FileObject getHomeDirectory()
throws NoSuchFileObject, // in the case the
specified home directory doesn't exist
FileSystemBackendException; // in the case
somehting in the backend fails (JDBC link down, SQL Exception)
FileObject getCurrentDirectory()
throws FileSystemBackendException; // in the case somehting
in the backend fails (JDBC link down, SQL Exception)
boolean changeDirectory(String dir)
throws NoSuchFileObject, // in the case the
specified home directory doesn't exist
FileSystemBackendException; // in the case
somehting in the backend fails (JDBC link down, SQL Exception)
FileObject getFileObject(String file)
throws NoSuchFileObject, // in the case the
specified home directory doesn't exist
FileSystemBackendException; // in the case
somehting in the backend fails (JDBC link down, SQL Exception)
boolean isRandomAccessible(); // no expected exceptions
void dispose(); // no
expected exceptions
}
Sorry for indentation, I don't know how to use the gmail to use monospace fonts.
--
Andrea Francia
http://andreafrancia.blogspot.com/