commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ernst de Haan <>
Subject [Digester] Generic digester patterns?
Date Thu, 02 Aug 2007 14:55:44 GMT
I'm struggling to implement generic digester patterns. Some hints or  
references to appropriate examples would be much appreciated!

This is my input XML:

     <Color r="0" g="0" b="0" />
     <Color r="76" g="0" b="76" />

and these are my Digester rules:

<pattern value="*/Color">
   <factory-create-rule classname="ColorFactory" />

<pattern value="Config">
   <object-create-rule classname="Config">
   <set-nested-properties-rule />

The factory is accessed properly, but I cannot get Digester to bind  
the result of the "*/Color" rule set (a java.awt.Color object) so it  
gets associated with the Config object.

Instead, I'm getting the following exception:

Exception in thread "main" java.lang.IllegalArgumentException: Cannot  
invoke com.pensioenpage.protea.ChartRenderConfig.setBackground -  
argument type mismatch
at org.apache.commons.digester.Digester.createSAXException 
at org.apache.commons.digester.Digester.createSAXException 
at org.apache.commons.digester.Digester.endElement(
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown  

but the argument type does match (the method accepts a  
java.awt.Paint, which is an interface implemented by java.awt.Color).

When I enable logging, I see the problem:

[DEBUG] Digester - [SetNestedPropertiesRule]{ChartRenderConfig/ 
background} Setting property 'background' to ''
[DEBUG] Digester - [SetNestedPropertiesRule]{ChartRenderConfig/ 
background} Set com.pensioenpage.protea.ChartRenderConfig properties
[DEBUG] ConvertUtils - Convert string '' to class 'java.awt.Paint'
[ERROR] PropertyUtils - Method invocation failed.  
<java.lang.IllegalArgumentException: argument type  
mismatch>java.lang.IllegalArgumentException: argument type mismatch

So how do I bind the Color object to the enclosing object in a  
generic manner?

My environment:
- Commons Digester 1.8.0
- Java 1.5.0
- Mac OS X 10.4.10

Kind regards,


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message