[ 
https://issues.apache.org/jira/browse/DIGESTER-133?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Simone Tripodi resolved DIGESTER-133.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 3.0
         Assignee: Simone Tripodi

Niall's hint works, please see committed 
[Digester133TestCase|http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/test/java/org/apache/commons/digester3/Digester133TestCase.java?view=markup]
 on Digester3

> Class fields are not set if class is inherited from HashMap if 
> commons-beanutils-1.8.0 is used
> ----------------------------------------------------------------------------------------------
>
>                 Key: DIGESTER-133
>                 URL: https://issues.apache.org/jira/browse/DIGESTER-133
>             Project: Commons Digester
>          Issue Type: Bug
>    Affects Versions: 1.6, 1.7, 1.8, 2.0
>         Environment: OS: Kubuntu 8.0.4, Java version is 1.5.0_15
> Windows XP, Java version 1.5.0_11-b03
>            Reporter: Alexander Kovalenko
>            Assignee: Simone Tripodi
>            Priority: Minor
>             Fix For: 3.0
>
>
> Class fields are not set if class is inherited from HashMap, value is put in 
> HashMap instead.
> I tried this simple test with  Digester 1.6, 1.7, 1.8 and 2.0. It works with 
> commons-beanutils-1.7.0, but does not work with commons-beanutils-1.8.0. 
> JUnit 4.4 was used for testing.
> ================ Class to be instantiated from XML ==========================
> import java.util.HashMap;
> public class MyClass extends HashMap<String, String> {
>       private boolean flag = false;
>       public boolean isFlag()
>       {
>               return flag;
>       }
>       public void setFlag(boolean flag)
>       {
>               this.flag = flag;
>       }
> }
> ================= Test ===================
> import static org.junit.Assert.assertTrue;
> import java.io.ByteArrayInputStream;
> import java.io.IOException;
> import org.apache.commons.digester.Digester;
> import org.junit.Test;
> import org.xml.sax.SAXException;
> public class TestDigester {
>       
>       @Test
>       public void testDigester() throws IOException, SAXException {
>               final String xml = "<myclass flag='true'/>";
>               
>               final Digester digester = new Digester();
>               digester.addObjectCreate("myclass", MyClass.class);
>               digester.addSetProperties("myclass");
>               
>               final MyClass res = (MyClass) digester.parse(new 
> ByteArrayInputStream(xml.getBytes()));
>               assertTrue(res.isFlag());
>       }
> }

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to