We are using the openEXI Java lib in Opendaylight project and we have encountered an issue. We want to use the same instance of Transmogrifier and EXIReader to perform encoding/decoding of xml messages. But if we do that, the decoding in EXIReader fails with "java.lang.ArrayIndexOutOfBoundsException: 2". The thing is, that this exception is only thrown if we encode/decode one xml message and then encode/decode second xml with same tags inside. It fails while decoding the second xml message.
This is the exception:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 2
at org.openexi.proc.io.StringValueScanner.scan(StringValueScanner.java:63)
at org.openexi.proc.io.SimpleScanner.doCharactersUntyped(SimpleScanner.java:246)
at org.openexi.proc.io.SimpleScanner.nextEvent(SimpleScanner.java:93)
at org.openexi.sax.EXIReader.doElement(EXIReader.java:439)
at org.openexi.sax.EXIReader.doElement(EXIReader.java:536)
at org.openexi.sax.EXIReader.doElement(EXIReader.java:536)
at org.openexi.sax.EXIReader.parse(EXIReader.java:316)
at org.openexi.sax.EXIReader.parse(EXIReader.java:179)
at org.opendaylight.controller.netconf.nettyutil.AbstractChannelInitializerTest.encodeDecode(AbstractChannelInitializerTest.java:131)
at org.opendaylight.controller.netconf.nettyutil.AbstractChannelInitializerTest.encodeExiReuseTrans(AbstractChannelInitializerTest.java:91)
at org.opendaylight.controller.netconf.nettyutil.AbstractChannelInitializerTest.main(AbstractChannelInitializerTest.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
For now, we have to instantiate new Transmogrifier for every message that we encode, but we would like to get rid of that.
I can provide a simple java class where this can be observed. The class contains the same exact initialization of Transmogrifier and EXIReader as we use in Opendaylight + required xml messages.
Maros
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Based on your test case java program (and data shown in it), I could reproduce the problem. It will be fixed in the next release. Thank you for reporting.
taki
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
We are using the openEXI Java lib in Opendaylight project and we have encountered an issue. We want to use the same instance of Transmogrifier and EXIReader to perform encoding/decoding of xml messages. But if we do that, the decoding in EXIReader fails with "java.lang.ArrayIndexOutOfBoundsException: 2". The thing is, that this exception is only thrown if we encode/decode one xml message and then encode/decode second xml with same tags inside. It fails while decoding the second xml message.
This is the exception:
For now, we have to instantiate new Transmogrifier for every message that we encode, but we would like to get rid of that.
I can provide a simple java class where this can be observed. The class contains the same exact initialization of Transmogrifier and EXIReader as we use in Opendaylight + required xml messages.
Maros
Mentioned java class can be found as an attachment to this bug in Opendaylight:
bug
Based on your test case java program (and data shown in it), I could reproduce the problem. It will be fixed in the next release. Thank you for reporting.
taki
Thank you for the quick response. Btw. do you have an estimate when will be the next version available ?
Please try latest Nagasena version 0000.0002.0053.0 libraries that was released yesterday.
Tested the 53 version and everything worked fine. Thanks a lot for the fix.