[
https://issues.apache.org/jira/browse/RANGER-3227?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17312076#comment-17312076
]
ZhouKang commented on RANGER-3227:
----------------------------------
Fix it: https://github.com/apache/ranger/pull/94
> 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
> Priority: Major
> Time Spent: 10m
> Remaining Estimate: 0h
>
> 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)