aboutsummaryrefslogtreecommitdiffstats
path: root/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDao.java
diff options
context:
space:
mode:
Diffstat (limited to 'ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDao.java')
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDao.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDao.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDao.java
index 9ac858277..a8449e307 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDao.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/PolicyDBDao.java
@@ -127,7 +127,7 @@ public class PolicyDBDao {
public static final String duplicatePolicyId = "Somehow, more than one policy with the id ";
public static final String foundInDB = " were found in the database";
- public static boolean isJunit = false;
+ private static boolean isJunit = false;
public static void setJunit(boolean isJunit) {
PolicyDBDao.isJunit = isJunit;
@@ -1250,6 +1250,9 @@ public class PolicyDBDao {
for(PDPPolicy policy : policies){
try{
String[] stringArray = getNameScopeAndVersionFromPdpPolicy(policy.getId());
+ if(stringArray == null) {
+ throw new IllegalArgumentException("Invalid input - policyID must contain name, scope and version");
+ }
List<PolicyEntity> policyEntityList;
Query getPolicyEntitiesQuery = em.createNamedQuery("PolicyEntity.findByNameAndScope");
getPolicyEntitiesQuery.setParameter("name", stringArray[0]);
@@ -1767,7 +1770,7 @@ public class PolicyDBDao {
policyId = policyName;
policyQuery = em.createQuery("SELECT p FROM PolicyEntity p WHERE p.policyName=:name AND p.scope=:scope");
policyQuery.setParameter("name", policyId);
- policyQuery.setParameter(scope, scope);
+ policyQuery.setParameter("scope", scope);
} else{
policyId = String.valueOf(policyID);
policyQuery = em.createNamedQuery("PolicyEntity.FindById");