Dukascopy
 
 
Wiki JStore Search Login

Attention! Read the forum rules carefully before posting a topic.

    Try to find an answer in Wiki before asking a question.
    Submit programming questions in this forum only.
    Off topics are strictly forbidden.

Any topics which do not satisfy these rules will be deleted.

java.lang.NullPointerException @ jforex.swapper.onTick
 Post subject: java.lang.NullPointerException @ jforex.swapper.onTick Post rating: 0   New post Posted: Thu 29 Sep, 2011, 12:47 
User avatar

User rating: 0
Joined: Mon 12 Sep, 2011, 12:02
Posts: 6
Location: Switzerland, Zürich
java.lang.NullPointerException
   at jforex.swapper.onTick(swapper.java:167)
   at com.dukascopy.dds2.greed.agent.strategy.tester.a.a(Unknown Source)
   at com.dukascopy.dds2.greed.agent.strategy.tester.l.run(Unknown Source)
   at com.dukascopy.dds2.greed.agent.strategy.tester.a.wI(Unknown Source)
   at com.dukascopy.dds2.greed.actions.StrategyTesterAction.vc(Unknown Source)
   at com.dukascopy.dds2.greed.actions.StrategyTesterAction.uB(Unknown Source)
   at com.dukascopy.dds2.greed.actions.c.run(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)


in 167

if (order.getState() == IOrder.State.FILLED)


I can not understand why the error occurs.
the tester start working without any error.


 
 Post subject: Re: java.lang.NullPointerException @ jforex.swapper.onTick Post rating: 0   New post Posted: Thu 29 Sep, 2011, 15:04 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
The exception you get is because you are likely to have not instantiated the order object, could you please provide a code fragment where you assign a value to the order object?


 
 Post subject: Re: java.lang.NullPointerException @ jforex.swapper.onTick Post rating: 0   New post Posted: Mon 03 Oct, 2011, 15:16 
User avatar

User rating: 0
Joined: Mon 12 Sep, 2011, 12:02
Posts: 6
Location: Switzerland, Zürich
API Support wrote:
The exception you get is because you are likely to have not instantiated the order object, could you please provide a code fragment where you assign a value to the order object?


i can't use code tag so i attach the java file with all code.

In begin of test, there are no errors, but with time its show this error

And with time my memory used with Jforex is rising very fast.


Attachments:
File comment: code
swapper.java [14.36 KiB]
Downloaded 291 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: java.lang.NullPointerException @ jforex.swapper.onTick Post rating: 0   New post Posted: Tue 04 Oct, 2011, 09:31 
User avatar

User rating:
Joined: Fri 31 Aug, 2007, 09:17
Posts: 6139
We did not manage to reproduce the exception. Please consider inserting in line 167 the null check in order to log values when the order is not among the active orders no more (i.e. the order with such label has been either CANCELED, CLOSED or it did not get created).
if(order == null){
    console.getErr().println("The order has not been found! magic="+magic+" inst.name()="+inst.name() + " counter="+counter);
}


 
 Post subject: Re: java.lang.NullPointerException @ jforex.swapper.onTick Post rating: 0   New post Posted: Wed 05 Oct, 2011, 22:42 
User avatar

User rating: 0
Joined: Mon 12 Sep, 2011, 12:02
Posts: 6
Location: Switzerland, Zürich
Just before using any "order" variable in onTick function i insert this code

if(order == null) 
            {
                return;
            }


Right now all work fine! Thanks.


 

Jump to:  

  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com