X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=POLICY-SDK-APP%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenecomp%2Fpolicy%2Fcontroller%2FPolicyValidationController.java;h=0f8b3795f6f1c0f573dabba0fe3d04ec2c6265d1;hb=e92ff832cf993db876f22b2d27562fedf59f5043;hp=cc6903b9198bc9335eb33cf4692e834f0906f87a;hpb=570290dc6ba8198e653022c2f6f8e5d01cfa8d1b;p=policy%2Fengine.git
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyValidationController.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyValidationController.java
index cc6903b91..0f8b3795f 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyValidationController.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/controller/PolicyValidationController.java
@@ -401,10 +401,8 @@ public class PolicyValidationController extends RestrictedBaseController {
int endNum = Integer.parseInt(tempString[1]);
String returnString = "Invalid Range:" + rMap.getKey() + " must be between "
+ startNum + " - " + endNum + ",";
- if (isInteger(value.replace("\"", ""))){
+ if (PolicyUtils.isInteger(value.replace("\"", ""))){
int result = Integer.parseInt(value.replace("\"", ""));
-
-
if (result < startNum || result > endNum){
responseString.append(returnString);
valid = false;
@@ -492,13 +490,20 @@ public class PolicyValidationController extends RestrictedBaseController {
if(policyData.getYamlparams().getLimit()==null){
responseString.append(" Guard Params Limit is Required " + "
");
valid = false;
- }else if(!isInteger(policyData.getYamlparams().getLimit())){
+ }else if(!PolicyUtils.isInteger(policyData.getYamlparams().getLimit())){
responseString.append(" Guard Params Limit Should be Integer " + "
");
valid = false;
}
if(policyData.getYamlparams().getTimeWindow()==null){
responseString.append("Guard Params Time Window is Required" + "
");
valid = false;
+ }else if(!PolicyUtils.isInteger(policyData.getYamlparams().getTimeWindow())){
+ responseString.append(" Guard Params Time Window Should be Integer " + "
");
+ valid = false;
+ }
+ if(policyData.getYamlparams().getTimeUnits()==null){
+ responseString.append("Guard Params Time Units is Required" + "
");
+ valid = false;
}
}else if("GUARD_BL_YAML".equals(policyData.getRuleProvider())){
if(policyData.getYamlparams().getBlackList()==null || policyData.getYamlparams().getBlackList().isEmpty()){
@@ -623,15 +628,6 @@ public class PolicyValidationController extends RestrictedBaseController {
return null;
}
- protected boolean isInteger(String number) {
- try{
- Integer.parseInt(number);
- }catch(NumberFormatException e){
- return false;
- }
- return true;
- }
-
protected String emptyValidator(String field){
String error;
if ("".equals(field) || field.contains(" ") || !field.matches("^[a-zA-Z0-9_]*$")) {