[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jibx-users
Subject:    [jibx-users]  XMLWriterBase: ArrayIndexOutOfBoundsException
From:       anshuk_geronimo <Anshuk_Chaudhuri () infosys ! com>
Date:       2009-07-13 6:26:23
Message-ID: 24456767.post () talk ! nabble ! com
[Download RAW message or body]


Hello,

I am trying to do some marshalling using jibx, everything is working
perfectly as expected, but only when closing the end parent tag, I am facing
an issue.
PFB the code below.
                                                                                      \
 fos = new FileOutputStream(file, true);
                                                                                      \
 // IXMLWriter wrapperWriter = null;
                                                                                      \
 IXMLWriter wrapperWriter = null;
                                                                                      \
 IXMLWriter writer=null;
                                                                                      \
 IBindingFactory bFactTransaction=null;
                                                                                      \
 IMarshallingContext mCtxTransaction=null;
                                                                                      \
 {
                                                                                      \
                
                                                                                      \
 bFactTransaction = BindingDirectory
                                                                                      \
                
.getFactory(object.getTransactions()
                                                                                      \
                
.getTransactions().get(0)
                                                                                      \
                
.getClass());
                                                                                      \
 mCtxTransaction = bFactTransaction
                                                                                      \
                
.createMarshallingContext();
                                                                                      \
 mCtxTransaction.setIndent(4);
                                                                                      \
 mCtxTransaction.setOutput(fos, "UTF-8");
                                                                                      \
 writer = mCtxTransaction.getXmlWriter();                                             \
                
                                                                                      \
                
                                                                                      \
 if (objectCount == 0) {
                                                                                      \
 mCtxTransaction.startDocument("UTF-8", null);
                                                                                      \
 writer.startTagClosed(0, "parent-tag");
                                                                                      \
 wrapperWriter = writer;
                                                                                      \
 }
                                                                                      \
 writer.startTagClosed(0, "child");
                                                                                      \
 writer.startTagClosed(0, "Header");
                                                                                      \
 writer.endTag(0, "Header");
                                                                                      \
 writer.startTagClosed(0, "items");
                                                                                      \
 //wrapperWriter = writer;
                                                                                      \
 }

                                                                                      \
 // marshall object
                                                                                      \
 ((IMarshallable) object.getTransactions()
                                                                                      \
                
.getTransactions().get(0))
                                                                                      \
                
.marshal(mCtxTransaction);
                                                                                      \
 writer.flush();
                                                                                      \
                
                                                                                      \
 if (somecondition) {
                                                                                      \
 System.out.println("writer==========="+writer+"depth"+writer.getNestingDepth());
                                                                                      \
 wrapperWriter.endTag(0, "items");
                                                                                      \


                                                                                      \
 }

                                                                                      \
                
                                                                                      \
 if (objectCount == (numberOfObjectsToFetch-1)) {
                                                                                      \
 System.out.println("ENTERED closing parent-tag");
                                                                                      \
 wrapperWriter.endTag(0, "parent-tag ");
                                                                                      \
 wrapperWriter.flush();
                                                                                      \
 }

Exception is taking place in the red bold line:

java.lang.ArrayIndexOutOfBoundsException
        at java.lang.System.arraycopy(Native Method)
        at
org.jibx.runtime.impl.StreamWriterBase.indent(StreamWriterBase.java:3
88)
        at
org.jibx.runtime.impl.XMLWriterBase.endTag(XMLWriterBase.java:332)
        at
com.testing.app.report.handler.xml.helper.XMLUtilHelper.generateXML(XM
LUtilHelper.java:153)
        at
com.testing.app.job.report.xml.APPTellerJob.generateXML(APPTellerJob.j
ava:213)
        at
com.testing.app.job.report.xml.APPTellerJob.execute(APPTellerJob.java:
108)
        at com.testing.app.job.SynchronousJob.run(SynchronousJob.java:52)
        at
com.testing.app.job.manager.ejb.JobManagerBean.doExecute(JobManagerBea
n.java:698)
        at
com.testing.app.job.manager.ejb.JobManagerBean.executeJob(JobManagerBe
an.java:667)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at
org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invoc
ation.invoke(ReflectionInvocationContext.java:158)
        at
org.apache.openejb.core.interceptor.ReflectionInvocationContext.proce
ed(ReflectionInvocationContext.java:141)
        at
org.apache.openejb.core.interceptor.InterceptorStack.invoke(Intercept
orStack.java:67)
        at
org.apache.openejb.core.stateless.StatelessContainer._invoke(Stateles
sContainer.java:210)
        at
org.apache.openejb.core.stateless.StatelessContainer._invoke(Stateles
sContainer.java:188)
        at
org.apache.openejb.core.stateless.StatelessContainer.invoke(Stateless
Container.java:165)
        at
org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(EjbO
bjectProxyHandler.java:217)
        at
org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(EjbObjectPr
oxyHandler.java:77)
        at
org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHa
ndler.java:321)
        at
org.apache.openejb.util.proxy.Jdk13InvocationHandler.invoke(Jdk13Invo
cationHandler.java:49)
        at $Proxy52.executeJob(Unknown Source)
        at
com.testing.app.timer.ejb.APPTimerBean.onJobTimer(APPTimerBean.java:39
5)
        at
com.testing.app.timer.ejb.APPTimerBean.ejbTimeout(APPTimerBean.java:28
6)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at
org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invoc
ation.invoke(ReflectionInvocationContext.java:158)
        at
org.apache.openejb.core.interceptor.ReflectionInvocationContext.proce
ed(ReflectionInvocationContext.java:141)
        at
org.apache.openejb.core.interceptor.InterceptorStack.invoke(Intercept
orStack.java:67)
        at
org.apache.openejb.core.stateless.StatelessContainer._invoke(Stateles
sContainer.java:210)
        at
org.apache.openejb.core.stateless.StatelessContainer._invoke(Stateles
sContainer.java:188)
        at
org.apache.openejb.core.stateless.StatelessContainer.invoke(Stateless
Container.java:165)
        at
org.apache.openejb.core.timer.EjbTimerServiceImpl.ejbTimeout(EjbTimer
ServiceImpl.java:284)
        at
org.apache.openejb.core.timer.EjbTimerServiceImpl.access$100(EjbTimer
ServiceImpl.java:43)
        at
org.apache.openejb.core.timer.EjbTimerServiceImpl$EjbTimeoutTimerTask
$1.run(EjbTimerServiceImpl.java:350)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown
Source
)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown
Source)
        at java.lang.Thread.run(Unknown Source)

Any help would be appreciated.


Anshuk 

-- 
View this message in context: \
http://www.nabble.com/XMLWriterBase%3A-ArrayIndexOutOfBoundsException-tp24456767p24456767.html
 Sent from the jibx-users mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic