You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by Bart Molenkamp <b....@bizzdesign.nl> on 2006/08/04 15:52:41 UTC
RE: Do not raise exception when you can prevent it (was Re: svncommit: r428677)
> -----Oorspronkelijk bericht-----
> Van: Thorsten Scherler [mailto:thorsten.scherler@wyona.com]
> Verzonden: vrijdag 4 augustus 2006 13:09
> Aan: Forrest Developers List
> Onderwerp: Do not raise exception when you can prevent it (was Re:
>
...
> IMO it is way cleaner to test whether the source.exist() before trying
> to read form it. This way a FileNotFoundException is prevented.
Please note that some source implementations don't return a correct
answer. For example, the SitemapSource (for cocoon://) always returns
true when asking for exists(), see:
http://svn.apache.org/repos/asf/cocoon/trunk/core/cocoon-core/src/main/j
ava/org/apache/cocoon/components/source/impl/SitemapSource.java
I don't know about other source implementations, but this one caused me
some trouble...
Bart.
Re: Do not raise exception when you can prevent it (was Re: svncommit:
r428677)
Posted by Ross Gardler <rg...@apache.org>.
Bart Molenkamp wrote:
>>-----Oorspronkelijk bericht-----
>>Van: Thorsten Scherler [mailto:thorsten.scherler@wyona.com]
>>Verzonden: vrijdag 4 augustus 2006 13:09
>>Aan: Forrest Developers List
>>Onderwerp: Do not raise exception when you can prevent it (was Re:
>>
>
> ...
>
>
>>IMO it is way cleaner to test whether the source.exist() before trying
>>to read form it. This way a FileNotFoundException is prevented.
>
>
> Please note that some source implementations don't return a correct
> answer. For example, the SitemapSource (for cocoon://) always returns
> true when asking for exists(), see:
>
> http://svn.apache.org/repos/asf/cocoon/trunk/core/cocoon-core/src/main/j
> ava/org/apache/cocoon/components/source/impl/SitemapSource.java
>
> I don't know about other source implementations, but this one caused me
> some trouble...
Ahhh... thanks for the heads up. This might be why the original Forrest
conf moudle was written with Try...catch blocks. We should bear this in
mind if a problem with the modified code arises.
Ross