You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ranger.apache.org by "ZhouKang (Jira)" <ji...@apache.org> on 2021/03/31 05:27:00 UTC
[jira] [Created] (RANGER-3227) Get Exception when visit result of
RangerClient.findRoles()
ZhouKang created RANGER-3227:
--------------------------------
Summary: Get Exception when visit result of RangerClient.findRoles()
Key: RANGER-3227
URL: https://issues.apache.org/jira/browse/RANGER-3227
Project: Ranger
Issue Type: Improvement
Components: Ranger
Reporter: ZhouKang
visit response of RangerClient.findRoles, you will get en exception
Sample code:
{code:java}
// code placeholder
RangerClient rangerClient = new RangerClient(hostName, userName, password);
List<RangerRole> allRoles = rangerClient.findRoles(null);
LOG.info("List of Roles {}", gsonBuilder.toJson(allRoles));
for (RangerRole role : allRoles) {
LOG.info("Role is : {}", role.getName());
}
{code}
you will get the exception
{code:java}
// code placeholder
Exception in thread "main" java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to org.apache.ranger.plugin.model.RangerRole
{code}
I think should use new GenericType<List<RangerRole>>(){} instead of List.class
--
This message was sent by Atlassian Jira
(v8.3.4#803005)