igniterealtime / REST-API-Client

Java REST API Client for the Openfire to manage Openfire instances by sending an REST/HTTP request to the server
Apache License 2.0
102 stars 62 forks source link

Any Type of get entity method returns null instead of List #43

Open fahimjubayer-dsi opened 4 years ago

fahimjubayer-dsi commented 4 years ago

When i try to use restclient.getUsers() i get UserEntities object. But then when i try to use userEntities.getUsers(), it is returning null. Facing similar issue for GroupEntities, MUCRoomEntities or any other get method for other entity types.

UserEntities userEntities = restclient.getUsers(); List<UserEntity> userEntityList = userEntities.getUsers();

userEntityList is always null. No Exception is thrown.

I am using this library in my application server. Currently i can successfully create and delete UserEntity using this library.

Library version 1.1.5

nsobadzhiev commented 4 years ago

Are you, by any chance, using JSON as accept type? If so, you can try switching to XML if that's ok in your project. As far as I see, the getUser receives the data correctly from the server, but cannot convert it to UserEntities. There seems to be an issue with the JSON parsing - something in this line:

if (result != null && isStatusCodeOK(result, restPath)) {
    return (T) result.readEntity(expectedResponse);
}

in RestClient