Instrumentinfo null pointer exception

Custom indicators, trading strategies, data export and recording and more...
DGDario
Posts: 14
Joined: Wed Feb 26, 2020 8:39 pm
Has thanked: 6 times

Instrumentinfo null pointer exception

Post by DGDario » Mon Mar 08, 2021 9:14 am

Hi, after update to the 7.2.0.13 api semplified reference the info.pips in the initialize function : 


public void initialize(String alias, InstrumentInfo info, Api api, InitialState initialState) {
this.api = api;
super.initialize(alias, info, this.api, initialState);
instrumentPips = info.pips;
init(this.api);
// currentSymbol = info.symbol;
}


generate a java.lang.NullPointerException

With the previous api version it works correctly.



 

Svyatoslav
Site Admin
Posts: 279
Joined: Mon Jun 11, 2018 11:44 am
Has thanked: 2 times
Been thanked: 31 times

Re: Instrumentinfo null pointer exception

Post by Svyatoslav » Mon Mar 08, 2021 9:27 am

Could you please specify which line exactly throws an exception now? I see that you call some "init" function, which is presumably not part of API, that's why I'm asking.
Do you observe the same behavior with demo modules? Does it happen reliably (i.e. on every start) or randomly? Could you share a short code that demonstrates the problem?

DGDario
Posts: 14
Joined: Wed Feb 26, 2020 8:39 pm
Has thanked: 6 times

Re: Instrumentinfo null pointer exception

Post by DGDario » Mon Mar 08, 2021 9:34 am

The line that throws the error is:

instrumentPips = info.pips;

It happens when the platform start. Then If I remove the plugin and add load it again it works

Svyatoslav
Site Admin
Posts: 279
Joined: Mon Jun 11, 2018 11:44 am
Has thanked: 2 times
Been thanked: 31 times

Re: Instrumentinfo null pointer exception

Post by Svyatoslav » Mon Mar 08, 2021 10:26 am

What is the last build where you didn't have such issue?

DGDario
Posts: 14
Joined: Wed Feb 26, 2020 8:39 pm
Has thanked: 6 times

Re: Instrumentinfo null pointer exception

Post by DGDario » Mon Mar 08, 2021 10:38 am

Build 9

Svyatoslav
Site Admin
Posts: 279
Joined: Mon Jun 11, 2018 11:44 am
Has thanked: 2 times
Been thanked: 31 times

Re: Instrumentinfo null pointer exception

Post by Svyatoslav » Mon Mar 08, 2021 11:42 am

Which mode are you using? Replay/live? If live - which feeds are you connected to?

DGDario
Posts: 14
Joined: Wed Feb 26, 2020 8:39 pm
Has thanked: 6 times

Re: Instrumentinfo null pointer exception

Post by DGDario » Mon Mar 08, 2021 1:06 pm

Live with rithmic feed

Svyatoslav
Site Admin
Posts: 279
Joined: Mon Jun 11, 2018 11:44 am
Has thanked: 2 times
Been thanked: 31 times

Re: Instrumentinfo null pointer exception

Post by Svyatoslav » Mon Mar 08, 2021 1:35 pm

I'm sorry, but I failed to reproduce that quickly. This is the code I used to test it: 
LastTradeDemoNoHistoryUsingPips.java
(1.41 KiB) Downloaded 192 times
and it loaded fine with live Rithmic when I restarting bookmap with "load workspace" checkbox on the launchpad. Could you please provide more details? Ideally - a code sample that helps reproduce the issue and step-by-step description of what you are doing. Video would be even better.
Attachments
LastTradeDemoNoHistoryUsingPips.java
(1.41 KiB) Downloaded 177 times

Post Reply