users@fi.java.net

Fast Info Set and large XML files

From: Swaminathan Gnanaskandan <gswami_at_gmail.com>
Date: Tue, 15 Dec 2009 19:36:48 +0530

FastInfoset throws the following exception when marshalling large XML files.
It works fine for smaller XML files.

Error writing marshalled document
java.io.IOException: Error writing to stream: java.io.IOException: Integer >
1,048,576
        at
org.jibx.runtime.impl.StAXWriter.startTagOpen(StAXWriter.java:161)
        at
org.jibx.runtime.impl.MarshallingContext.startTagAttributes(MarshallingContext.java:541)
        at
com.cisco.avm.corona.concurrent.model.stats.JiBX_MungeAdapter.JiBX_concurrent_model_binding_marshal_1_9()
        at
com.cisco.avm.corona.concurrent.model.stats.TransactionStats.JiBX_concurrent_model_binding_marshal_1_0(TransactionStats.java)
        at
com.cisco.avm.corona.concurrent.model.stats.JiBX_MungeAdapter.JiBX_concurrent_model_binding_marshal_1_10()
        at
com.cisco.avm.corona.concurrent.model.stats.TransactionStatistics.JiBX_concurrent_model_binding_marshal_1_0(TransactionStatistics.java)
        at
com.cisco.avm.corona.concurrent.model.stats.JiBX_MungeAdapter.JiBX_concurrent_model_binding_marshal_1_11()
        at
com.cisco.avm.corona.concurrent.model.stats.TrafficStatistics.JiBX_concurrent_model_binding_marshal_1_0(TrafficStatistics.java)
        at
com.cisco.avm.corona.concurrent.model.ObservedTraffic.JiBX_concurrent_model_binding_marshal_1_0(ObservedTraffic.java)
        at
com.cisco.avm.corona.concurrent.model.JiBX_concurrent_model_bindingObservedTraffic_access.marshal()
        at
com.cisco.avm.corona.concurrent.model.ObservedTraffic.marshal(ObservedTraffic.java)
        at
org.jibx.runtime.impl.MarshallingContext.marshalRoot(MarshallingContext.java:1021)
        at
org.jibx.runtime.impl.MarshallingContext.marshalDocument(MarshallingContext.java:1041)
        at
com.cisco.avm.corona.model.marshaller.XmlMarshaller.marshallBinaryXml(XmlMarshaller.java:93)
        at
com.cisco.avm.corona.model.marshaller.XmlMarshaller.marshall(XmlMarshaller.java:67)
        at
com.cisco.avm.corona.model.marshaller.XmlMarshaller.marshall(XmlMarshaller.java:51)
        at
com.cisco.avm.corona.messaging.TAModelMessageCodec.encode(TAModelMessageCodec.java:94)
        at
com.cisco.avm.corona.messaging.TAModelMessageCodec.encode(TAModelMessageCodec.java:21)
        at
com.cisco.avm.messaging.codec.AbstractAmxMessageCodec.encode(AbstractAmxMessageCodec.java:47)
        at
org.apache.mina.filter.codec.demux.DemuxingProtocolEncoder.encode(DemuxingProtocolEncoder.java:134)
        at
org.apache.mina.filter.codec.ProtocolCodecFilter.filterWrite(ProtocolCodecFilter.java:298)
        at
org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterWrite(DefaultIoFilterChain.java:506)
        at
org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1400(DefaultIoFilterChain.java:46)
        at
org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.filterWrite(DefaultIoFilterChain.java:805)
        at
org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.filterWrite(DefaultIoFilterChain.java:731)
        at
org.apache.mina.core.filterchain.DefaultIoFilterChain.callPreviousFilterWrite(DefaultIoFilterChain.java:506)
        at
org.apache.mina.core.filterchain.DefaultIoFilterChain.fireFilterWrite(DefaultIoFilterChain.java:498)
        at
org.apache.mina.core.session.AbstractIoSession.write(AbstractIoSession.java:428)
        at
org.apache.mina.core.session.AbstractIoSession.write(AbstractIoSession.java:369)
        at
com.cisco.avm.messaging.transport.AmxConnector.sendMessage(AmxConnector.java:123)
        at
com.cisco.avm.corona.applayout.AppServiceImpl.exportModel(AppServiceImpl.java:243)
        at
com.cisco.avm.corona.applayout.AppServiceImpl$ExportTask.run(AppServiceImpl.java:301)
        at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
        at
java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
        at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
        at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
        at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
        at java.lang.Thread.run(Thread.java:619)


I think the problem is in the encoder

    protected final void encodeNonZeroIntegerOnSecondBitFirstBitOne(int i)
throws IOException {
        if (i < EncodingConstants.INTEGER_2ND_BIT_SMALL_LIMIT) {
            // [1, 64] ( [0, 63] ) 6 bits
            write(0x80 | i);
        } else if (i < EncodingConstants.INTEGER_2ND_BIT_MEDIUM_LIMIT) {
            // [65, 8256] ( [64, 8255] ) 13 bits
            i -= EncodingConstants.INTEGER_2ND_BIT_SMALL_LIMIT;
            _b = (0x80 | EncodingConstants.INTEGER_2ND_BIT_MEDIUM_FLAG) | (i
>> 8); // 010 00000
            // _b = 0xC0 | (i >> 8); // 010 00000
            write(_b);
            write(i & 0xFF);
        } else if (i < EncodingConstants.INTEGER_2ND_BIT_LARGE_LIMIT) {
            // [8257, 1048576] ( [8256, 1048575] ) 20 bits
            i -= EncodingConstants.INTEGER_2ND_BIT_MEDIUM_LIMIT;
            _b = (0x80 | EncodingConstants.INTEGER_2ND_BIT_LARGE_FLAG) | (i
>> 16); // 0110 0000
            // _b = 0xE0 | (i >> 16); // 0110 0000
            write(_b);
            write((i >> 8) & 0xFF);
            write(i & 0xFF);
        } else {
* throw new IOException(

CommonResourceBundle.getInstance().getString("message.integerMaxSize",
                    new
Object[]{Integer.valueOf(EncodingConstants.INTEGER_2ND_BIT_LARGE_LIMIT)}));*
        }
    }

How do I control indexing?

Any pointers to this problem is appreciated.

Regards,
Swami