JAVA UPA API StringIndexOutOfBoundsException when doing message encodeInit

I'm receiving StringIndexOutOfBoundsException when I do msg.encodeInit, I can debug/see the code because UPA API is obfuscated.

// init message
int ret = msg.encodeInit(encodeIter, 0);


java.lang.StringIndexOutOfBoundsException: String index out of range: 4
    at java.lang.StringLatin1.charAt(StringLatin1.java:44) ~[?:?]
    at java.lang.String.charAt(String.java:704) ~[?:?]
    at com.thomsonreuters.upa.codec.R.A(Unknown Source) ~[upa-7.4.0.jar:upaj7.4.F9]
    at com.thomsonreuters.upa.codec.K.B(Unknown Source) ~[upa-7.4.0.jar:upaj7.4.F9]
    at com.thomsonreuters.upa.codec.K.A(Unknown Source) ~[upa-7.4.0.jar:upaj7.4.F9]
    at com.thomsonreuters.upa.codec.K.A(Unknown Source) ~[upa-7.4.0.jar:upaj7.4.F9]
    at com.thomsonreuters.upa.codec.K.A(Unknown Source) ~[upa-7.4.0.jar:upaj7.4.F9]
    at com.thomsonreuters.upa.codec.K.B(Unknown Source) ~[upa-7.4.0.jar:upaj7.4.F9]
    at com.thomsonreuters.upa.codec.K.A(Unknown Source) ~[upa-7.4.0.jar:upaj7.4.F9]
    at com.thomsonreuters.upa.codec.u.encodeInit(Unknown Source) ~[upa-7.4.0.jar:upaj7.4.F9]


Does channel.getBuffer(size, packedBuffer, error) returns a new instance of TransportBuffer or if it recycles an existing instance?

if it recycles, - and we have the exception above in msg.encodeInit, where the TransportBuffer has been assigned to the EncodeIterator >> is the TransportBuffer impacted? Should we "clean" it?



Best Answer

  • wasin.w
    wasin.w admin
    Answer ✓
    Hello @mreina


    It seems you are using the UPA Java version 7.4.0 which is quite old, end of life, and no longer supported. If you can replicate the issue in other environments such as Dev or QA, I strongly suggest you test with the latest version of ETA Java (rebrand of UPA Java). You can download the ETA Java from the RTSDK package via the RTSDK Java download page or GitHub.


Answers

  • UPA has later been open-sourced. It has been rebranded at Elektron Transport API (ETA).

    It now lives here: https://github.com/Refinitiv/Real-Time-SDK/tree/master/Java


    Despite package name changes (to reflect company name change) I would think you can still follow the source code. I doubt the part you are interested in has changed. Here's a starting point : Source code for Msg class


    Going forward you can of course simply switch to the (newer) open source version, i.e. ETA. You'll then get the transparency you are used to when working with open source libraries: The jar, the javadoc and the source are all in Maven Central so your IDE can easily access it and stepping through code will be a breeze.


    Link to artifact in Maven Central: https://search.maven.org/artifact/com.refinitiv.eta/eta







  • thank you.

    This happened during production and we cannot just switch jars like that.
    It would be helpfull if you provide the obfuscation logs of your api.