.findByNameAndPolicyId(resource.getKey(), policy.getId());
if (xResDef == null) {
throw new Exception(resource.getKey() + ": is not a valid resource-type. policy='"+  policy.getName() + "' service='"+ policy.getService() + "'");
}
XXPolicyResource xPolRes = new XXPolicyResource();
<BUG>xPolRes = (XXPolicyResource) rangerAuditFields.populateAuditFields(xPolRes, xPolicy);
xPolRes.setIsExcludes(policyRes.getIsExcludes());</BUG>
xPolRes.setIsRecursive(policyRes.getIsRecursive());
xPolRes.setPolicyId(policy.getId());
xPolRes.setResDefId(xResDef.getId());

.findByNameAndPolicyId(resource.getKey(), policy.getId());
if (xResDef == null) {
throw new Exception(resource.getKey() + ": is not a valid resource-type. policy='"+  policy.getName() + "' service='"+ policy.getService() + "'");
}
XXPolicyResource xPolRes = new XXPolicyResource();
xPolRes = rangerAuditFields.populateAuditFields(xPolRes, xPolicy);
xPolRes.setIsExcludes(policyRes.getIsExcludes());
xPolRes.setIsRecursive(policyRes.getIsRecursive());
xPolRes.setPolicyId(policy.getId());
xPolRes.setResDefId(xResDef.getId());
