REST-API-Client icon indicating copy to clipboard operation
REST-API-Client copied to clipboard

Any Type of get entity method returns null instead of List

Open fahimjubayer-dsi opened this issue 4 years ago • 1 comments

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

fahimjubayer-dsi avatar Apr 22 '20 08:04 fahimjubayer-dsi

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

nsobadzhiev avatar May 04 '20 15:05 nsobadzhiev