gnu-arch-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnu-arch-users] Nit


From: Jan Hudec
Subject: Re: [Gnu-arch-users] Nit
Date: Wed, 22 Oct 2003 09:05:14 +0200
User-agent: Mutt/1.5.4i

On Tue, Oct 21, 2003 at 16:24:05 -0700, Dustin Sallings wrote:
>       public List getLinesOfFile(String f) throws IOException {
>               String realFile=translatePath(f);
>               InputStream is=openTheStream(realFile);
>               List rv=getLinesOfStream(is);
>               is.close();
>               return(rv);
>       }
> 
>       The question, then, is whether translatePath()'s exception causes 
>       the program to be incorrect now.  I do not believe it does.  Although a 
> new 
> reason has been introduced, it is still an IO problem in that there 
> isn't much of a difference between an inability to open a file and an 
> inability to locate the path to a file to the higher level.

Yes, it's a BIG difference. Since the caller only knows about the file
it is passing as argument, it should expect that file can't be accessed.
However, an IOError for a different file (unrelated from caller's point
of view) is given.

Acutaly in this case, opening one file simply means opening two, so it
still makes sense. Now imagine another function was called there to log
something. Now having the errors in a same class stopped making any
sense.

-------------------------------------------------------------------------------
                                                 Jan 'Bulb' Hudec 
<address@hidden>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]