Coverity issues from couple of weeks back...

Bosco
´╗┐On 5/24/18, 12:25 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:

    Hi,
   
    Please find the latest report on new defect(s) introduced to Apache Ranger found with Coverity Scan.
   
    5 new defect(s) introduced to Apache Ranger found with Coverity Scan.
    2 defect(s), reported by Coverity Scan earlier, were marked fixed in the recent build analyzed by Coverity Scan.
   
    New defect(s) Reported-by: Coverity Scan
    Showing 5 of 5 defect(s)
   
   
    ** CID 175683:    (FORWARD_NULL)
   
   
    ________________________________________________________________________________________________________
    *** CID 175683:    (FORWARD_NULL)
    /security-admin/src/test/java/org/apache/ranger/rest/TestXUserREST.java: 1043 in org.apache.ranger.rest.TestXUserREST.test58updateXAuditMapVXResourceNull()()
    1037     Mockito.verify(xResourceService).readResource(null);
    1038     Mockito.verify(restErrorUtil.createRESTException(Mockito.anyString(), (MessageEnums)Mockito.any()));
    1039     }
    1040     @Test
    1041     public void test58updateXAuditMapVXResourceNull() {
    1042    
    >>>     CID 175683:    (FORWARD_NULL)
    >>>     Passing "null" to "updateXAuditMap", which dereferences it.
    1043     Mockito.when(xUserMgr.updateXAuditMap(null)).thenReturn(null);
    1044     VXAuditMap retvXAuditMap=xUserRest.updateXAuditMap(null);
    1045     Mockito.verify(xUserMgr).updateXAuditMap(null);
    1046     assertNull(retvXAuditMap);
    1047    
    1048     }
    /security-admin/src/test/java/org/apache/ranger/rest/TestXUserREST.java: 1045 in org.apache.ranger.rest.TestXUserREST.test58updateXAuditMapVXResourceNull()()
    1039     }
    1040     @Test
    1041     public void test58updateXAuditMapVXResourceNull() {
    1042    
    1043     Mockito.when(xUserMgr.updateXAuditMap(null)).thenReturn(null);
    1044     VXAuditMap retvXAuditMap=xUserRest.updateXAuditMap(null);
    >>>     CID 175683:    (FORWARD_NULL)
    >>>     Passing "null" to "updateXAuditMap", which dereferences it.
    1045     Mockito.verify(xUserMgr).updateXAuditMap(null);
    1046     assertNull(retvXAuditMap);
    1047    
    1048     }
    1049     @Test
    1050     public void test59deleteXAuditMap() {
   
    ** CID 175682:  Null pointer dereferences  (FORWARD_NULL)
   
   
    ________________________________________________________________________________________________________
    *** CID 175682:  Null pointer dereferences  (FORWARD_NULL)
    /security-admin/src/main/java/org/apache/ranger/rest/XUserREST.java: 554 in org.apache.ranger.rest.XUserREST.updateXPermMap(org.apache.ranger.view.VXPermMap)()
    548     if (vXPermMap != null) {
    549     if (xResourceService.readResource(vXPermMap.getResourceId()) == null) {
    550     throw restErrorUtil.createRESTException("Invalid Input Data - No resource found with Id: " + vXPermMap.getResourceId());
    551     }
    552     }
    553    
    >>>     CID 175682:  Null pointer dereferences  (FORWARD_NULL)
    >>>     Passing null pointer "vXPermMap" to "updateXPermMap", which dereferences it.
    554     return xUserMgr.updateXPermMap(vXPermMap);
    555     }
    556    
    557     @DELETE
    558     @Path("/permmaps/{id}")
    559     @RangerAnnotationClassName(class_name = VXPermMap.class)
   
    ** CID 175681:  Incorrect expression  (USELESS_CALL)
   
   
    ________________________________________________________________________________________________________
    *** CID 175681:  Incorrect expression  (USELESS_CALL)
    /security-admin/src/test/java/org/apache/ranger/service/TestRangerServiceDefService.java: 550 in org.apache.ranger.service.TestRangerServiceDefService.test4getAllServiceDefs()()
    544     Assert.assertNotNull(dbRangerServiceDef);
    545     Mockito.verify(daoManager).getXXResourceDef();
    546     Mockito.verify(daoManager).getXXAccessTypeDef();
    547     Mockito.verify(daoManager).getXXPolicyConditionDef();
    548     Mockito.verify(daoManager).getXXContextEnricherDef();
    549     Mockito.verify(daoManager).getXXEnumDef();
    >>>     Calling "(org.apache.ranger.db.RangerDaoManager)org.mockito.Mockito.verify(daoManager).getXXEnumElementDef()" is only useful for its return value, which is ignored.
    550     Mockito.verify(daoManager).getXXEnumElementDef();
    551     }
    552    
    553     @Test
    554     public void test5getPopulatedViewObject() {
    555     XXPortalUserDao xPortalUserDao = Mockito.mock(XXPortalUserDao.class);
   
    ** CID 175680:  Null pointer dereferences  (FORWARD_NULL)
   
   
    ________________________________________________________________________________________________________
    *** CID 175680:  Null pointer dereferences  (FORWARD_NULL)
    /security-admin/src/test/java/org/apache/ranger/rest/TestXUserREST.java: 838 in org.apache.ranger.rest.TestXUserREST.test45updateXPermMap()()
    832    
    833     Mockito.verify(xUserMgr).updateXPermMap(permMap);
    834     Mockito.verify(xResourceService).readResource(permMap.getResourceId());
    835     }
    836     @Test
    837     public void test45updateXPermMap() {
    >>>     CID 175680:  Null pointer dereferences  (FORWARD_NULL)
    >>>     Passing "null" to "updateXPermMap", which dereferences it.
    838     Mockito.when(xUserMgr.updateXPermMap(null)).thenReturn(null);
    839     VXPermMap retVxGroup=xUserRest.updateXPermMap(null);
    840     assertNull(retVxGroup);
    841     Mockito.verify(xUserMgr).updateXPermMap(null);
    842     }
    843     @Test
   
    ** CID 175679:  Null pointer dereferences  (FORWARD_NULL)
   
   
    ________________________________________________________________________________________________________
    *** CID 175679:  Null pointer dereferences  (FORWARD_NULL)
    /security-admin/src/m
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB