FuelSDK-Java icon indicating copy to clipboard operation
FuelSDK-Java copied to clipboard

Nullpointer when calling response.getObject()

Open Geooorg opened this issue 7 years ago • 1 comments

Hello,

it's a bit disturbing that a NullpointerException is thrown when calling response.getObject();

Example:

ETResponse<ETList> response = client.retrieve(ETList.class, filter);
// assertNotNull(response);
ETList etList = response.getObject();
// .... will fail under certain circumstances. 

This can easily fixed in ETResponse.java:

public T getObject() {
        ETResult<T> result = getResult();
        if (result != null)
            return result.getObject();
        return null;
}

Would love to have this implemented this way. Thanks

Geooorg avatar Oct 26 '16 08:10 Geooorg

Hi @Geooorg this happens to me when I do getObject() after retrieving an extension. The api returns me responseCode ="OK" but I don't get the dataextension.

client.retrieve(ETDataExtension.class, "key=" + "EXTERNAL_KEY").getObject() //nullpointer

Do you know why I get nullpointer when getting the object if the extension exists?

thanks

regards

alexmanrique avatar May 05 '17 12:05 alexmanrique