mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrea Francia" <and...@andreafrancia.it>
Subject Re: Exceptions of the FileSystemView
Date Thu, 02 Oct 2008 15:48:23 GMT
2008/10/2 Emmanuel Lecharny <elecharny@gmail.com>:
> Andrea Francia wrote:
>>
>> 2008/10/2 Steve Ulrich <steve.ulrich@proemion.com>:
>>
>>>
>>> Hi!
>>>
>>>
>>>>
>>>> Niklas Gustavsson [mailto:niklas@protocol7.com] wrote
>>>>
>>>> Yes, I'm aware that we can chain and replace exceptions thrown by the
>>>> various protocols, that was not my concern. My question was if
>>>> IOExceptions semantics matches the error conditions that we talk about
>>>> here. From the Javadoc: "Signals that an I/O exception of some sort
>>>> has occurred". I'm not sure if this is true for many of the cases
>>>> where the FtpServer file system abstraction fails. But then again,
>>>> this might be a case of splitting hairs. What do the rest of you
>>>> think?
>>>>
>>>
>>> Using IOException for anything not IO related isn't a good practice.
>>>
>>
>> I/O mean input/oputput, it does not cover only the I/O to real
>> filesystem it cover also I/O trough the net sockets, the
>> RemoteException used in RMI is an IOException.
>>
>
> That does not mean FtpException should not inherit from IoException. This is
> also an option.

Please, consider that I start the discussion about the exception
thrown the FileSystemView methods.
I never said that an FtpException should inherith from IOException.
I said that I would prefer that FileSystemView uses the IOException
and the FileNotFoundException.

Another complain is about an interface with methods that all throws
the generic FtpException.

public interface FileSystemView {
  FileObject getHomeDirectory() throws FtpException;
  FileObject getCurrentDirectory() throws FtpException;
  boolean changeDirectory(String dir) throws FtpException;
  FileObject getFileObject(String file) throws FtpException;
  boolean isRandomAccessible() throws FtpException;
  void dispose();
}

At this point why not throwing just Exception?
Or if, we want use the IOException, we can always be specific:

public interface FileSystemView {
  FileObject getHomeDirectory() throws FileSystemBackendException,
FileSystemFileNotFoundException;
  FileObject getCurrentDirectory() throws FileSystemBackendException;
  boolean changeDirectory(String dir) throws
FileSystemBackendException, FileSystemFileNotFoundException;
  FileObject getFileObject(String file) throws
FileSystemBackendException, FileSystemFileNotFoundException;
  boolean isRandomAccessible();
  void dispose();
}

-- 
Andrea Francia
http://andreafrancia.blogspot.com/

Mime
View raw message