commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robert burrell donkin <robertburrelldon...@blueyonder.co.uk>
Subject Re: [digester] using digester's exceptions
Date Tue, 11 Mar 2003 21:55:16 GMT
hi erik

my short answer is: digester is open source - use it any way you want!

my longer answer is: i can't think of any major issues that you'll have 
using XmlLoadException in that way. if you want to follow sun's javadoc 
guidelines you might want to add a @throws tag.

- robert

On Tuesday, March 11, 2003, at 06:38 PM, Erik Price wrote:

> Does it go against the intent/contract of the Digester package to use 
> some of its classes out of the context in which they were designed?  I 
> want to raise an exception if my field is still null after trying to set 
> the field with a Digester instance, but I'm wondering if this is really 
> appropriate:
>
> public abstract class AbstractReport implements Report {
>     private Criteria criteria;
>
>     /**
>      * Generates a Report from information in the passed-in file.
>      */
>     public AbstractReport(File file) throws IOException {
>         Digester digester = new Digester();
>         digester.push(this);
>         digester.addObjectCreate("criteria",
>                                  "com.erikprice.oatmeal.Criteria");
>         digester.addSetNext("criteria", "setCriteria");
>         // other rules go here
>         digester.parse(file);
>
>         if (this.criteria == null) {
> ------->    throw new XmlLoadException("criteria field not registered");
>         }
>         // do other processing using this.criteria
>     }
> }
>
>
>
> Thanks,
>
> Erik
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>


Mime
View raw message