question

Upvotes
Accepted
2 4 9 11

NullPointerException when printing FieldList content from update message to screen

Hi

When developing API according to Real-Time-SDK-2.0.0.L1.java, our client met NullPointerException when trying to print message content to screen in debug mode. Please find below screenshot:

However when print whole message which includes field list, it works. Please find below, the one in red circle are what client trying to extract:

Could you please help:

1. How to detect what was the cause of nullpointer?

2. If there any alternative way to locate and extract certain field from an message?

Thank you

elektronrefinitiv-realtimeelektron-sdkema-apirrtelektron-message-apijava
image001.jpg (349.0 KiB)
image002.jpg (264.1 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
Accepted
25.3k 87 12 25

Hi @Xiaorong.Xu

Is the client accessing the Msg Payload outside the EMA thread e.g. they are trying to access the payload after returning from OnUpdateMsg handler?

The EMA API owns the Msg and you cannot access it once you have returned from the event Handler callback e.g. onRefreshMsg(), onUpdateMsg() etc.

If they want to access the Msg after returning from the above callbacks, then they should clone the msg before using in a different thread e.g.

public void onUpdateMsg(UpdateMsg updateMsg, OmmConsumerEvent event)
{
    UpdateMsg clonedUpdMsg = EmaFactory.createUpdateMsg(updateMsg);
    // store / pass clonedUpdMsg for use in other thread..
    //......
    return;
}
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvote
2 4 9 11

Thank you very much Nalla. Problem resolved.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

And thank you too, for getting back and confirming - much appreciated.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.