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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to