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 Sun, 17 Jun 2018 14:27:51 GMT
Few issues. Mostly on test code. Please review.

Thanks

Bosco


´╗┐On 6/17/18, 1:07 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.
    
    5 new defect(s) introduced to Apache Ranger found with Coverity Scan.
    6 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 175920:  FindBugs: Dodgy code  (FB.DLS_DEAD_LOCAL_STORE)
    /security-admin/src/test/java/org/apache/ranger/common/TestServiceUtil.java: 1573 in org.apache.ranger.common.TestServiceUtil.testVXAssetToPublicObject()()
    
    
    ________________________________________________________________________________________________________
    *** CID 175920:  FindBugs: Dodgy code  (FB.DLS_DEAD_LOCAL_STORE)
    /security-admin/src/test/java/org/apache/ranger/common/TestServiceUtil.java: 1573 in org.apache.ranger.common.TestServiceUtil.testVXAssetToPublicObject()()
    1567                     vXAsset.setAssetType(3);
    1568                     vXAsset.setActiveStatus(RangerCommonEnums.STATUS_ENABLED);
    1569                     vXAsset.setName("hive");
    1570                     vXAsset.setDescription("hive description");
    1571                     vXAsset.setConfig("/myConfig");
    1572     
    >>>     CID 175920:  FindBugs: Dodgy code  (FB.DLS_DEAD_LOCAL_STORE)
    >>>     Dead store to actualVXRepository.
    1573                     VXRepository actualVXRepository = new VXRepository();
    1574                     actualVXRepository = serviceUtil.vXAssetToPublicObject(vXAsset);
    1575     
    1576                     Assert.assertNotNull(actualVXRepository);
    1577                     Assert.assertEquals(expectedVXRepository.getId(), actualVXRepository.getId());
    1578                     Assert.assertEquals(expectedVXRepository.getName(), actualVXRepository.getName());
    
    ** CID 175919:  FindBugs: Dodgy code  (FB.DLS_DEAD_LOCAL_STORE)
    /security-admin/src/test/java/org/apache/ranger/common/TestJSONUtil.java: 106 in org.apache.ranger.common.TestJSONUtil.testWriteJsonToJavaObject()()
    
    
    ________________________________________________________________________________________________________
    *** CID 175919:  FindBugs: Dodgy code  (FB.DLS_DEAD_LOCAL_STORE)
    /security-admin/src/test/java/org/apache/ranger/common/TestJSONUtil.java: 106 in org.apache.ranger.common.TestJSONUtil.testWriteJsonToJavaObject()()
    100     
    101             @Test
    102             public void testWriteJsonToJavaObject(){
    103                     String jsonString = "[\"hdfs\",\"hive\",\"knox\"]";
    104                     String expectedSetString = "[hive, hdfs, knox]";
    105                     Set<String> testSet = new HashSet<>();
    >>>     CID 175919:  FindBugs: Dodgy code  (FB.DLS_DEAD_LOCAL_STORE)
    >>>     Dead store to expectedSet.
    106                     Set<String> expectedSet = new HashSet<>();
    107                     expectedSet = jsonUtil.writeJsonToJavaObject(jsonString, testSet.getClass());
    108     
    109                     String actualSetString = expectedSet.toString();
    110                     Assert.assertEquals(expectedSetString, actualSetString);
    111     
    112     
    113             }
    
    ** CID 175918:  Null pointer dereferences  (NULL_RETURNS)
    /security-admin/src/test/java/org/apache/ranger/common/TestJSONUtil.java: 109 in org.apache.ranger.common.TestJSONUtil.testWriteJsonToJavaObject()()
    
    
    ________________________________________________________________________________________________________
    *** CID 175918:  Null pointer dereferences  (NULL_RETURNS)
    /security-admin/src/test/java/org/apache/ranger/common/TestJSONUtil.java: 109 in org.apache.ranger.common.TestJSONUtil.testWriteJsonToJavaObject()()
    103                     String jsonString = "[\"hdfs\",\"hive\",\"knox\"]";
    104                     String expectedSetString = "[hive, hdfs, knox]";
    105                     Set<String> testSet = new HashSet<>();
    106                     Set<String> expectedSet = new HashSet<>();
    107                     expectedSet = jsonUtil.writeJsonToJavaObject(jsonString, testSet.getClass());
    108     
    >>>     CID 175918:  Null pointer dereferences  (NULL_RETURNS)
    >>>     Calling a method on null object "expectedSet".
    109                     String actualSetString = expectedSet.toString();
    110                     Assert.assertEquals(expectedSetString, actualSetString);
    111     
    112     
    113             }
    
    ** CID 175917:  FindBugs: Dodgy code  (FB.DLS_DEAD_LOCAL_STORE)
    /security-admin/src/test/java/org/apache/ranger/common/TestServiceUtil.java: 1892 in org.apache.ranger.common.TestServiceUtil.testToRangerPolicy()()
    
    
    ________________________________________________________________________________________________________
    *** CID 175917:  FindBugs: Dodgy code  (FB.DLS_DEAD_LOCAL_STORE)
    /security-admin/src/test/java/org/apache/ranger/common/TestServiceUtil.java: 1892 in org.apache.ranger.common.TestServiceUtil.testToRangerPolicy()()
    1886                     vXPermObj.setIpAddress("10.129.35.86");
    1887     
    1888                     vXPermObjList.add(vXPermObj);
    1889     
    1890                     vXPolicy.setPermMapList(vXPermObjList);
    1891     
    >>>     CID 175917:  FindBugs: Dodgy code  (FB.DLS_DEAD_LOCAL_STORE)
    >>>     Dead store to actualRangerPolicy.
    1892                     RangerPolicy actualRangerPolicy = new RangerPolicy();
    1893                     actualRangerPolicy = serviceUtil.toRangerPolicy(vXPolicy, service);
    1894     
    1895                     Assert.assertNotNull(actualRangerPolicy);
    1896                     Assert.assertEquals(expectedRangerPolicy.getId(), actualRangerPolicy.getId());
    1897                     Assert.assertEquals(expectedRangerPolicy.getName(), actualRangerPolicy.getName());
    
    ** CID 175921:  Null pointer dereferences  (NULL_RETURNS)
    /security-admin/src/test/java/org/apache/ranger/common/TestDateUtil.java: 114 in org.apache.ranger.common.TestDateUtil.testStringToDate()()
    
    
    ________________________________________________________________________________________________________
    *** CID 175921:  Null pointer dereferences  (NULL_RETURNS)
    /security-admin/src/test/java/org/apache/ranger/common/TestDateUtil.java: 114 in org.apache.ranger.common.TestDateUtil.testStringToDate()()
    108     
    109                     Calendar cal = Calendar.getInstance();
    110     	cal.set(2018 - 1900, 04, 31);
    111     	Date expectedDate = new Date(cal.get(Calendar.YEAR),cal.get(Calendar.MONTH),cal.get(Calendar.DATE));
    112     
    113                     Date actualDate = dateUtil.stringToDate(dateString, dateFormat);
    >>>     CID 175921:  Null pointer dereferences  (NULL_RETURNS)
    >>>     Calling a method on null object "actualDate".
    114                     Assert.assertEquals(expectedDate.getYear(), actualDate.getYear());
    115     	Assert.assertEquals(expectedDate.getDay(), actualDate.getDay());
    116     	Assert.assertEquals(expectedDate.getMonth(), actualDate.getMonth());
    117     
    118             }
    119     
    
    
    ________________________________________________________________________________________________________
    To view the defects in Coverity Scan visit, https://u2389337.ct.sendgrid.net/wf/click?upn=08onrYu34A-2BWcWUl-2F-2BfV0V05UPxvVjWch-2Bd2MGckcRZSbhom32dlDl11LWEm9nX11zsOWMf5dv3Q9Mogo-2FGua3FsLRTFft2V-2FOFC9o0P2e0-3D_d04ZgyDzSjlwpjXIuOFYDNE6R93Lal83MDClQK32PZvbJjiLJnWJMe67UwM18rK8Xn762tEQqe0P1gWdnW2qNJbiXAjbwCsPZuFKs-2FWFTK5sX2ieXxeveoXfW00iXmOHjSeKQPlyvuXT9yvUHN5-2BteGkvu2qwR1eIw7i8mDgOJeaDfFU0mrd3lOK3NHQ3I57yYQWVcwIvriAQLlmRYUxMQ-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_d04ZgyDzSjlwpjXIuOFYDNE6R93Lal83MDClQK32PZvbJjiLJnWJMe67UwM18rK8SHEccFvkdx-2FMkBREQgZ0TO5vPo4gt194Mmx6kqYGfxdgyaSPDVnnrjSWBfSzX3dcrtPl0FQCMQ3NWncfz56aqT8aRbWRWJ4RdXLx8nJpbRiqilhqGLBR3fqezfJRxs7X-2FnSWY6zXu3QeAkRP6OACUQ-3D-3D
    
    



Mime
View raw message