Bitcoin.co.id wrapper Nullpointer

Issue #254 resolved
Benjamin Cordes created an issue

reported by creon

"If the query in the getActiveOrdersImpl method in BitcoinCoIDWrapper.java is not positive, the apiResponse variable is just set to the returned response such that in cannot be casted to an ArrayList<Order> in the method GetOrderDetail. So if the API returns garbage (which apparently can happen) then the NuBot crashes in line 327 because the object does not point to anything useful, and throws an unhandled NullPointerException.

I think the cleanest way would be that getActiveOrdersImpl itself throws an exception if the response wasn't positive. My workaround is now just to catch the NullPointerException, but this of course is a hack."

Comments (1)

  1. Sam Griffiths

    I was missing a step in the getOrderDetail method. I needed to check that the response from getActiveOrders was positive before trying to cast as an ArrayList. If it isn;t posistive I pass the set ApiError through to the caller.

  2. Log in to comment