ranger-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Abhishek Kumar <abhishekkumar100...@gmail.com>
Subject Re: Review Request 73326: RANGER-3227: Add GenericType for response handling
Date Tue, 11 May 2021 18:45:24 GMT


> On May 4, 2021, 4:10 p.m., Abhay Kulkarni wrote:
> > intg/src/main/java/org/apache/ranger/RangerClient.java
> > Line 457 (original), 454 (patched)
> > <https://reviews.apache.org/r/73326/diff/1/?file=2249696#file2249696line458>
> >
> >     Please consider enclosing even a single statement in else clause inside curly
brackets for readabilty and ease of maintenance.
> 
> Zhou Kang wrote:
>     Fixed

Will update in the next review.


> On May 4, 2021, 4:10 p.m., Abhay Kulkarni wrote:
> > intg/src/main/java/org/apache/ranger/RangerClient.java
> > Line 466 (original), 491 (patched)
> > <https://reviews.apache.org/r/73326/diff/1/?file=2249696#file2249696line495>
> >
> >     Please consider if such checks are necessary in all callAPI() functions; responseHandler()
call throws exception if the clientResponse is null anyway (line 461).
> 
> Zhou Kang wrote:
>     `responseType` is 4th params of callAPI(), if clientResponse is not null, there will
get a NPE in `clientResponse.getEntity(null);`
>     
>     I think it may happened in wrong call of callAPI()

I believe the checks are IntelliJ suggestions and are not absolutely required. As Zhou mentioned,
responseType is a param of the callAPI() function and is different from clientResponse which
is the return of the responseHandler().


> On May 4, 2021, 4:10 p.m., Abhay Kulkarni wrote:
> > intg/src/main/java/org/apache/ranger/RangerClient.java
> > Lines 504 (patched)
> > <https://reviews.apache.org/r/73326/diff/1/?file=2249696#file2249696line511>
> >
> >     How is this method different from one on line 484? Can the earlier method be
used generically everwhere the class-type needs to be specified (and this method be removed)?
> 
> Zhou Kang wrote:
>     this method return nothing, a sample is 
>     ```
>      public void deleteServiceDef(long serviceDefId) throws RangerServiceException {
>             callAPI(DELETE_SERVICEDEF_BY_ID.applyUrlFormat(serviceDefId), null);
>         }
>     ```
>     
>     If use 
>     
>     ```
>      callAPI(DELETE_SERVICEDEF_BY_ID.applyUrlFormat(serviceDefId), null); 
>     ```
>     
>     will got e error
>     
>     ```
>     Ambiguous method call. Both
>     callAPI(API,Map<String, String>, Object, Class<Object>)
>     callAPI(API,Map<String, String>,Object,GenericType<Object>)
>     in RangerClient match
>     ```

Yes, the earlier method can be used generically everywhere. Using both the Class and GenericType
as different function params since the underlying ClientResponse library supports getEntity
for both.


- Abhishek


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/73326/#review222944
-----------------------------------------------------------


On April 30, 2021, 8:53 p.m., Abhishek  Kumar wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/73326/
> -----------------------------------------------------------
> 
> (Updated April 30, 2021, 8:53 p.m.)
> 
> 
> Review request for ranger, Abhay Kulkarni, Madhan Neethiraj, Ramesh Mani, Sailaja Polavarapu,
and Velmurugan Periasamy.
> 
> 
> Bugs: RANGER-3227
>     https://issues.apache.org/jira/browse/RANGER-3227
> 
> 
> Repository: ranger
> 
> 
> Description
> -------
> 
> Fix deserialization issues when parsing REST reponses by using GenericType.
> 
> 
> Diffs
> -----
> 
>   intg/src/main/java/org/apache/ranger/RangerClient.java c7e32dc59 
>   ranger-examples/sample-client/src/main/java/org/apache/ranger/examples/sampleclient/SampleClient.java
b380127bf 
> 
> 
> Diff: https://reviews.apache.org/r/73326/diff/1/
> 
> 
> Testing
> -------
> 
> Tested the changes on local machine.
> 
> 
> Thanks,
> 
> Abhishek  Kumar
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message