On Mon, 18 Mar 2002, Greg McCreath wrote:
> Date: Mon, 18 Mar 2002 13:04:56 +0100 > From: Greg McCreath <[EMAIL PROTECTED]> > Reply-To: Jakarta Commons Developers List <[EMAIL PROTECTED]> > To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]> > Subject: Digester/BuanUtils Error trapping ... > > > Hi All, > > This is my first posting here. I'm looking at using the Digester class to > construct object trees from a config XML file. I looks like a handy tool. > I've been investigating it this morning and noticed that no error/exception > is thrown by beanutils when a property setter does not exist for a class > defined in the config XML. The code just performs a 'continue' and ignores > what might be a nasty cause of problems. I can't trap it in DTD for every > possible class as it is arbitrary. > > It seems as though I have no way to detect if logical errors exist in the > XML. Also, I've noticed a SAXException is thrown when an invalid class in > contained in the XML (?). > > Am I wrong? Can I detect when property setters do not exist? > The standard SetPropertiesRule is based on the philosophy that you just match up the properties that exist, and ignore the ones that don't. If we didn't do that, you could not do things like what Tomcat 4 requires on a Valve declaration, where the className attribute chooses the implementation class, and all of the rest of the properties are used to call appropriate setter methods on the instantiated bean class. If you really want to catch errors, you should create your own variant of SetPropertiesRule that throws exceptions when property names do not match, instead of ignoring this scenario. > Many thanks > > Greg. > Craig McClanahan -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>