summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2023-06-12 12:43:59 +0100
committerVasyl Razinkov <vasyl.razinkov@est.tech>2023-06-12 22:25:33 +0000
commitae0d495d89156181abcd969f302e181821897336 (patch)
treea0f544a613e295bbef233e482c7d20016f6d7ccb /catalog-be/src/main
parent98f08c1f9b617e670cd4c71321c9152e8f63b18c (diff)
Improve error handling for user-created Policies
Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Change-Id: I86bf83584da186d03a3e54c3839280b10df71939 Issue-ID: SDC-4531
Diffstat (limited to 'catalog-be/src/main')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/PolicyUtils.java12
1 files changed, 3 insertions, 9 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/PolicyUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/PolicyUtils.java
index b1bc10b10a..7494e75259 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/PolicyUtils.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/validation/PolicyUtils.java
@@ -131,9 +131,9 @@ public class PolicyUtils {
try {
int beginIndex = policyName.lastIndexOf(GROUP_POLICY_NAME_DELIMETER) + GROUP_POLICY_NAME_DELIMETER.length();
String counterStr = policyName.substring(beginIndex, endIndex);
- counter = Integer.valueOf(counterStr) + 1;
+ counter = Integer.parseInt(counterStr) + 1;
} catch (NumberFormatException | IndexOutOfBoundsException e) {
- log.error("#extractNextPolicyCounter - An error occurred when attempting to extract counter from policy name [{}]. ", policyName, e);
+ log.warn("#extractNextPolicyCounter - Cannot extract counter from policy name [{}]. ", policyName, e);
}
return counter;
}
@@ -160,13 +160,7 @@ public class PolicyUtils {
}
private static boolean isUpdatedField(String oldField, String newField) {
- boolean isUpdatedField = false;
- if (isEmpty(oldField) && isNotEmpty(newField)) {
- isUpdatedField = true;
- } else if (isNotEmpty(oldField) && isNotEmpty(newField) && !oldField.equals(newField)) {
- isUpdatedField = true;
- }
- return isUpdatedField;
+ return (isEmpty(oldField) && isNotEmpty(newField)) || (isNotEmpty(oldField) && isNotEmpty(newField) && !oldField.equals(newField));
}
private static void logImmutableFieldUpdateWarning(String oldValue, String newValue, JsonPresentationFields field) {