[
https://issues.apache.org/jira/browse/RANGER-3227?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Abhishek Kumar resolved RANGER-3227.
------------------------------------
Fix Version/s: 2.2.0
Resolution: Fixed
[Commit|https://github.com/apache/ranger/commit/c11c781ac29d3c604e1b90496ffcb337f65b3c65]
> 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
> Assignee: Abhishek Kumar
> Priority: Major
> Fix For: 2.2.0
>
> 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)