ranger-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Don Bosco Durai <bo...@apache.org>
Subject FW: New Defects reported by Coverity Scan for Apache Ranger
Date Fri, 11 May 2018 18:07:31 GMT
Please review and fix if needed.

Thanks

Bosco


´╗┐On 5/10/18, 1:10 AM, "scan-admin@coverity.com" <scan-admin@coverity.com> wrote:

    Hi,
    
    Please find the latest report on new defect(s) introduced to Apache Ranger found with
Coverity Scan.
    
    3 new defect(s) introduced to Apache Ranger found with Coverity Scan.
    
    
    New defect(s) Reported-by: Coverity Scan
    Showing 3 of 3 defect(s)
    
    
    ** CID 175611:    (FORWARD_NULL)
    
    
    ________________________________________________________________________________________________________
    *** CID 175611:    (FORWARD_NULL)
    /security-admin/src/test/java/org/apache/ranger/rest/TestAssetREST.java: 950 in org.apache.ranger.rest.TestAssetREST.testGetReportLogsForAuditAdmin()()
    944             public void testGetReportLogsForAuditAdmin() {
    945                     SearchCriteria searchCriteria = new SearchCriteria();
    946                     List<SortField> sortFields = null;
    947                     List<VXTrxLog> vXTrxLogs = new ArrayList<VXTrxLog>();
    948                     VXTrxLogList vXTrxLogList = new VXTrxLogList();
    949                     vXTrxLogList.setVXTrxLogs(vXTrxLogs);
    >>>     CID 175611:    (FORWARD_NULL)
    >>>     Passing null pointer "sortFields" to "extractCommonCriterias", which
dereferences it.
    950                     Mockito.when(searchUtil.extractCommonCriterias(request, sortFields)).thenReturn(searchCriteria);
    951                     Mockito.when(searchUtil.extractString((HttpServletRequest) Mockito.any(),
    952                                     (SearchCriteria) Mockito.any(), Mockito.anyString(),
Mockito.anyString(), Mockito.anyString()))
    953                                     .thenReturn("test");
    954                     Mockito.when(searchUtil.extractInt((HttpServletRequest) Mockito.any(),
    955                                     (SearchCriteria) Mockito.any(), Mockito.anyString(),
Mockito.anyString()))
    /security-admin/src/test/java/org/apache/ranger/rest/TestAssetREST.java: 970 in org.apache.ranger.rest.TestAssetREST.testGetReportLogsForAuditAdmin()()
    964                                     (SearchCriteria) Mockito.any(), Mockito.anyString(),
Mockito.anyString(), Mockito.anyString());
    965                     Mockito.verify(searchUtil).extractInt((HttpServletRequest) Mockito.any(),
    966                                     (SearchCriteria) Mockito.any(), Mockito.anyString(),
Mockito.anyString());
    967                     Mockito.verify(searchUtil, Mockito.times(2)).extractDate((HttpServletRequest)
Mockito.any(),
    968                                     (SearchCriteria) Mockito.any(), Mockito.anyString(),
Mockito.anyString(), Mockito.anyString());
    969                     Mockito.verify(assetMgr).getReportLogs(searchCriteria);
    >>>     CID 175611:    (FORWARD_NULL)
    >>>     Passing null pointer "sortFields" to "extractCommonCriterias", which
dereferences it.
    970                     Mockito.verify(searchUtil).extractCommonCriterias(request, sortFields);
    971             }
    972     
    973     
    974             @Test
    975             public void testGetReportLogsForAuditKeyAdmin() {
    
    ** CID 175610:    (FORWARD_NULL)
    
    
    ________________________________________________________________________________________________________
    *** CID 175610:    (FORWARD_NULL)
    /security-admin/src/test/java/org/apache/ranger/rest/TestAssetREST.java: 981 in org.apache.ranger.rest.TestAssetREST.testGetReportLogsForAuditKeyAdmin()()
    975             public void testGetReportLogsForAuditKeyAdmin() {
    976                     SearchCriteria searchCriteria = new SearchCriteria();
    977                     List<SortField> sortFields = null;
    978                     List<VXTrxLog> vXTrxLogs = new ArrayList<VXTrxLog>();
    979                     VXTrxLogList vXTrxLogList = new VXTrxLogList();
    980                     vXTrxLogList.setVXTrxLogs(vXTrxLogs);
    >>>     CID 175610:    (FORWARD_NULL)
    >>>     Passing null pointer "sortFields" to "extractCommonCriterias", which
dereferences it.
    981                     Mockito.when(searchUtil.extractCommonCriterias(request, sortFields)).thenReturn(searchCriteria);
    982                     Mockito.when(searchUtil.extractString((HttpServletRequest) Mockito.any(),
    983                                     (SearchCriteria) Mockito.any(), Mockito.anyString(),
Mockito.anyString(), Mockito.anyString()))
    984                                     .thenReturn("test");
    985                     Mockito.when(searchUtil.extractInt((HttpServletRequest) Mockito.any(),
    986                                     (SearchCriteria) Mockito.any(), Mockito.anyString(),
Mockito.anyString()))
    /security-admin/src/test/java/org/apache/ranger/rest/TestAssetREST.java: 1001 in org.apache.ranger.rest.TestAssetREST.testGetReportLogsForAuditKeyAdmin()()
    995                                     (SearchCriteria) Mockito.any(), Mockito.anyString(),
Mockito.anyString(), Mockito.anyString());
    996                     Mockito.verify(searchUtil).extractInt((HttpServletRequest) Mockito.any(),
    997                                     (SearchCriteria) Mockito.any(), Mockito.anyString(),
Mockito.anyString());
    998                     Mockito.verify(searchUtil, Mockito.times(2)).extractDate((HttpServletRequest)
Mockito.any(),
    999                                     (SearchCriteria) Mockito.any(), Mockito.anyString(),
Mockito.anyString(), Mockito.anyString());
    1000                     Mockito.verify(assetMgr).getReportLogs(searchCriteria);
    >>>     CID 175610:    (FORWARD_NULL)
    >>>     Passing null pointer "sortFields" to "extractCommonCriterias", which
dereferences it.
    1001                     Mockito.verify(searchUtil).extractCommonCriterias(request, sortFields);
    1002             }
    1003     
    1004     	public Map<String, String> getSampleConfig() {
    1005     		Map<String, String> configs = new HashMap<String, String>();
    1006     		configs.put("username", "servicemgr");
    
    ** CID 175609:  Incorrect expression  (USELESS_CALL)
    /security-admin/src/test/java/org/apache/ranger/biz/TestRangerBizUtil.java: 756 in org.apache.ranger.biz.TestRangerBizUtil.testCheckUserAccessibleSuccessForAdmin()()
    
    
    ________________________________________________________________________________________________________
    *** CID 175609:  Incorrect expression  (USELESS_CALL)
    /security-admin/src/test/java/org/apache/ranger/biz/TestRangerBizUtil.java: 756 in org.apache.ranger.biz.TestRangerBizUtil.testCheckUserAccessibleSuccessForAdmin()()
    750             }
    751     
    752             @Test
    753             public void testCheckUserAccessibleSuccessForAdmin(){
    754                     Collection<String> roleList = new ArrayList<String>();
    755                     roleList.add(RangerConstants.ROLE_SYS_ADMIN);
    >>>     CID 175609:  Incorrect expression  (USELESS_CALL)
    >>>     Calling "roleList.contains("ROLE_ADMIN_AUDITOR")" is only useful for
its return value, which is ignored.
    756                     roleList.contains(RangerConstants.ROLE_ADMIN_AUDITOR);
    757                     Mockito.when(userMgr.getRolesByLoginId(vXUser.getName())).thenReturn(
    758                                     roleList);
    759                     Mockito.when(vXUser.getUserRoleList()).thenReturn(roleList);
    760     
    761                     currentUserSession.setUserAdmin(true);
    
    
    ________________________________________________________________________________________________________
    To view the defects in Coverity Scan visit, https://u2389337.ct.sendgrid.net/wf/click?upn=08onrYu34A-2BWcWUl-2F-2BfV0V05UPxvVjWch-2Bd2MGckcRZSbhom32dlDl11LWEm9nX11zsOWMf5dv3Q9Mogo-2FGua3FsLRTFft2V-2FOFC9o0P2e0-3D_d04ZgyDzSjlwpjXIuOFYDNE6R93Lal83MDClQK32PZvjc0onIoXBiTI8cy9uJQg7fnwjfkjjjosoKihKLaGM3X0cUZtnfBxTJyVoaliR5k-2FOCKqqA1yoqvwH0CR1i2VxKr9W7cbBna2HylPb52T-2Fea7du8p8jUuewSGpkMke8hCZzdNHO7GZsfEAY1J4uXOPILZ5uFuGU9YR8UQjblehZg-3D-3D
    
      To manage Coverity Scan email notifications for "bosco@apache.org", click https://u2389337.ct.sendgrid.net/wf/click?upn=08onrYu34A-2BWcWUl-2F-2BfV0V05UPxvVjWch-2Bd2MGckcRbVDbis712qZDP-2FA8y06Nq4HK0JLY-2BbZ-2FD0yvjg-2BbWSwquqqdEYtbR9nIDW-2BM81kI8TiABM2LsH3tiPfMWf-2FvOsjZSWngS5IRVC-2FH5Pl4zyaK1OE6Dh-2BhR6pXASEFJKZLM-3D_d04ZgyDzSjlwpjXIuOFYDNE6R93Lal83MDClQK32PZvjc0onIoXBiTI8cy9uJQg7D4KwdZI5QWWkEvbfpEecn0gA9sQxSyIHfmpxAD-2F-2BAg7LgpMKPrizbCduVwAo9IMdGsXXI9QePDHCxxQMH13ImcLWMMGpS-2FlLt-2BNjqNRzCOBwq8PZXlFlQM8gWr9M1JqeqL-2BLxq0iRUBKOvZjR51wlQ-3D-3D
    
    



Mime
View raw message