question

Upvotes
Accepted
2 2 6 8

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-sdkrrtema-apielektron-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
24.9k 86 10 22

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 2 6 8

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.