|
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.
NullPointerException since comment is null |
[nobu3000]
|
Post subject: NullPointerException since comment is null |
Post rating: 0
|
Posted: Thu 23 Apr, 2009, 06:36
|
|
User rating: 0
Joined: Tue 31 Mar, 2009, 07:19 Posts: 4
|
The following is a part of my code:
------------------------------------------------------- for (IOrder order: engine.getOrders(instrument)) { if (order.getComment().equals(COMMENT1)) { -------------------------------------------------------
It caused NullPointerException at order.getComment().equals(COMMENT1) after partial fill message. Is this a bug of JForex? If not, how can I avoid this error? Thanks.
|
|
|
|
 |
API Support
|
Post subject: Re: NullPointerException |
Post rating: 0
|
Posted: Thu 23 Apr, 2009, 15:28
|
|
User rating: ∞
Joined: Fri 31 Aug, 2007, 09:17 Posts: 6139
|
This is not JForex bug since comment can be null in order. To avoid this, use construction like :
------------------------------------------------------- for (IOrder order: engine.getOrders(instrument)) { if (COMMENT1.equals(order.getComment())) { -------------------------------------------------------
but only if COMMENT1 is constant or you sure it's not null, otherwise use additional check for null : if (COMMENT1!=null && COMMENT1.equals(order.getComment()))
|
|
|
|
 |
|
Pages: [
1
]
|
|
|
|
|