ranger-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ZhouKang (Jira)" <j...@apache.org>
Subject [jira] [Commented] (RANGER-3227) Get Exception when visit result of RangerClient.findRoles()
Date Fri, 07 May 2021 11:40:00 GMT

    [ https://issues.apache.org/jira/browse/RANGER-3227?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17340753#comment-17340753
] 

ZhouKang commented on RANGER-3227:
----------------------------------

[~abhi_2110] Thank you for your review. Please review for updating.

> 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
>          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)

Mime
View raw message