DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=32743>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=32743

           Summary: Adding DEBUG to log4j.properties results in
                    IndexOutOfBoundsException
           Product: Commons
           Version: unspecified
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: major
          Priority: P2
         Component: Betwixt
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Adding the following line to log4j.properties results in an exception when 
running code that normally runs without error:

log4j.rootLogger=DEBUG

The trace/exception follows:

End event threw exception
java.lang.IndexOutOfBoundsException: Index: 3, Size: 3
        at java.util.ArrayList.RangeCheck(ArrayList.java:507)
        at java.util.ArrayList.get(ArrayList.java:324)
        at org.apache.commons.collections.ArrayStack.peek(Unknown Source)
        at org.apache.commons.betwixt.io.read.ReadContext.getCurrentElement
(ReadContext.java:228)
        at org.apache.commons.betwixt.io.read.BeanBindAction.update
(BeanBindAction.java:167)
        at org.apache.commons.betwixt.io.read.BeanBindAction.end
(BeanBindAction.java:157)
        at org.apache.commons.betwixt.io.BeanRuleSet$ActionMappingRule.end
(BeanRuleSet.java:316)
        at org.apache.commons.digester.Digester.endElement(Digester.java:1067)
        at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown 
Source)
        at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement
(Unknown Source)
        at org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(Unknown 
Source)
        at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown 
Source)
        at 
org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElement
Hook(Unknown Source)
        at 
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher
.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument
(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.commons.digester.Digester.parse(Digester.java:1610)
        at com.test.data.TestBetwixt.main(TestBetwixt.java:49)

Code used to produce this error:

/* $Id$ */
/*
 * Copyright 2004 [insert company name]
 */

package com.lantern.platform.tools.data;

import java.io.StringReader;
import java.io.StringWriter;

import org.apache.commons.betwixt.IntrospectionConfiguration;
import org.apache.commons.betwixt.io.BeanReader;
import org.apache.commons.betwixt.io.BeanWriter;

/**
 * TestBetwixt.java created on Dec 13, 2004.
 * 
 * @author ryan crumley
 * @version $Revision$ $Date$
 */
public class TestBetwixt {
        
        public static final void main(String args[]) throws Exception{
        StringWriter out = new StringWriter();
        out.write("<?xml version='1.0'?>");

        BeanWriter writer = new BeanWriter(out);
        
        IntrospectionConfiguration configuration = writer.getXMLIntrospector
().getConfiguration();
        configuration.setAttributesForPrimitives(true);
        configuration.setWrapCollectionsInElement(false);
        
        writer.setWriteEmptyElements( true );

        PersonBean personBean = new PersonBean();
        personBean.setName("ryan c");
        personBean.setAge(24);
        
        writer.write(personBean);
        
        System.out.println("out: " + out);
        
        StringReader xmlReader = new StringReader(out.toString());
        
        BeanReader reader = new BeanReader();
        reader.getXMLIntrospector().setConfiguration(configuration);
        reader.registerBeanClass(PersonBean.class);
        
        PersonBean person = (PersonBean) reader.parse(xmlReader);
        
        // send bean to system out
        System.out.println(person);
    }

}

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to