Please review and fix where required. Thanks
Bosco On 10/12/17, 12:42 AM, "scan-ad...@coverity.com" <scan-ad...@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. 1 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 3 of 3 defect(s) ** CID 167552: FindBugs: Correctness (FB.GC_UNRELATED_TYPES) /security-admin/src/main/java/org/apache/ranger/biz/ServiceDBStore.java: 1891 in org.apache.ranger.biz.ServiceDBStore.validatePolicyItems(java.util.List)() ________________________________________________________________________________________________________ *** CID 167552: FindBugs: Correctness (FB.GC_UNRELATED_TYPES) /security-admin/src/main/java/org/apache/ranger/biz/ServiceDBStore.java: 1891 in org.apache.ranger.biz.ServiceDBStore.validatePolicyItems(java.util.List)() 1885 1886 if (policyItem.getGroups() != null && (policyItem.getGroups().contains(null) || policyItem.getGroups().contains(""))) { 1887 isPolicyItemValid = false; 1888 break; 1889 } 1890 >>> CID 167552: FindBugs: Correctness (FB.GC_UNRELATED_TYPES) >>> String is incompatible with expected argument type org.apache.ranger.plugin.model.RangerPolicy$RangerPolicyItemAccess. 1891 if (CollectionUtils.isEmpty(policyItem.getAccesses()) || policyItem.getAccesses().contains(null) || policyItem.getAccesses().contains("")) { 1892 isPolicyItemValid = false; 1893 break; 1894 } 1895 } 1896 } ** CID 167551: Control flow issues (DEADCODE) /agents-common/src/main/java/org/apache/ranger/plugin/policyresourcematcher/RangerDefaultPolicyResourceMatcher.java: 293 in org.apache.ranger.plugin.policyresourcematcher.RangerDefaultPolicyResourceMatcher.isCompleteMatch(java.util.Map, java.util.Map)() ________________________________________________________________________________________________________ *** CID 167551: Control flow issues (DEADCODE) /agents-common/src/main/java/org/apache/ranger/plugin/policyresourcematcher/RangerDefaultPolicyResourceMatcher.java: 293 in org.apache.ranger.plugin.policyresourcematcher.RangerDefaultPolicyResourceMatcher.isCompleteMatch(java.util.Map, java.util.Map)() 287 Collection<String> policyKeys = policyResources == null ? null : policyResources.keySet(); 288 boolean keysMatch = resourceKeys != null && policyKeys != null && CollectionUtils.isEqualCollection(resourceKeys, policyKeys); 289 290 if (keysMatch) { 291 for (RangerResourceDef resourceDef : serviceDef.getResources()) { 292 String resourceName = resourceDef.getName(); >>> CID 167551: Control flow issues (DEADCODE) >>> Execution cannot reach the expression "null" inside this statement: "resourceValues = ((resource...". 293 RangerPolicyResource resourceValues = resources == null ? null : resources.get(resourceName); 294 RangerPolicyResource policyValues = policyResources == null ? null : policyResources.get(resourceName); 295 296 if (resourceValues == null || CollectionUtils.isEmpty(resourceValues.getValues())) { 297 ret = (policyValues == null || CollectionUtils.isEmpty(policyValues.getValues())); 298 } else if (policyValues != null && CollectionUtils.isNotEmpty(policyValues.getValues())) { ** CID 167550: Control flow issues (DEADCODE) /agents-common/src/main/java/org/apache/ranger/plugin/policyresourcematcher/RangerDefaultPolicyResourceMatcher.java: 253 in org.apache.ranger.plugin.policyresourcematcher.RangerDefaultPolicyResourceMatcher.isCompleteMatch(org.apache.ranger.plugin.policyengine.RangerAccessResource, java.util.Map)() ________________________________________________________________________________________________________ *** CID 167550: Control flow issues (DEADCODE) /agents-common/src/main/java/org/apache/ranger/plugin/policyresourcematcher/RangerDefaultPolicyResourceMatcher.java: 253 in org.apache.ranger.plugin.policyresourcematcher.RangerDefaultPolicyResourceMatcher.isCompleteMatch(org.apache.ranger.plugin.policyengine.RangerAccessResource, java.util.Map)() 247 Collection<String> policyKeys = policyResources == null ? null : policyResources.keySet(); 248 boolean keysMatch = resourceKeys != null && policyKeys != null && CollectionUtils.isEqualCollection(resourceKeys, policyKeys); 249 250 if (keysMatch) { 251 for (RangerResourceDef resourceDef : serviceDef.getResources()) { 252 String resourceName = resourceDef.getName(); >>> CID 167550: Control flow issues (DEADCODE) >>> Execution cannot reach the expression "null" inside this statement: "resourceValue = ((resource ...". 253 String resourceValue = resource == null ? null : resource.getValue(resourceName); 254 RangerResourceMatcher matcher = allMatchers == null ? null : allMatchers.get(resourceName); 255 256 if (StringUtils.isEmpty(resourceValue)) { 257 ret = matcher == null || matcher.isCompleteMatch(resourceValue, evalContext); 258 } else { ________________________________________________________________________________________________________ To view the defects in Coverity Scan visit, https://u2389337.ct.sendgrid.net/wf/click?upn=08onrYu34A-2BWcWUl-2F-2BfV0V05UPxvVjWch-2Bd2MGckcRZSbhom32dlDl11LWEm9nX11zsOWMf5dv3Q9Mogo-2FGua3FsLRTFft2V-2FOFC9o0P2e0-3D_d04ZgyDzSjlwpjXIuOFYDNE6R93Lal83MDClQK32PZs2nrVn-2BWGuZ2e3F3PSBvX0CnRQQN7YzSecz5PMxR093wioVRxxaIfZD28f9PQxpbrVI73czcDojVdOBtsG3ojeOkoZd7rDGRwl2vF-2BIvw53-2Bg95Uk8zqDX-2Fj8DRR5Jz27qsie9ePIrN3pcvdRRUVYNtkG-2F71hHIjPJFzkTrSg4Uw-3D-3D To manage Coverity Scan email notifications for "bo...@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_d04ZgyDzSjlwpjXIuOFYDNE6R93Lal83MDClQK32PZs2nrVn-2BWGuZ2e3F3PSBvX0F9nHbsh1eXR1io-2FL6rdtB-2BRcq8bIeyd-2FD3u0V8IEwGUFgmkegYWMP0ui2Z6lhYv96j0Pg044L-2F-2BeJZCHLzKsOSQkbcgXfPNo0kWLff4uJfGSd-2BscEnvPW7YBJUhbaKIt86pKHuY73RKj2ClvnOv8zQ-3D-3D