aboutsummaryrefslogtreecommitdiffstats
path: root/models-pdp/src
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2019-04-16 11:08:38 +0000
committerliamfallon <liam.fallon@est.tech>2019-04-16 11:08:38 +0000
commit46c8422501ac8321e11493693f2ad5b2ea8e1293 (patch)
tree696cb9c74fe54ab8fa1c5d9e1cf03b8f10662368 /models-pdp/src
parentcf720ed258f922da14e4ce245c7308d6a0399a4a (diff)
Fix null not accepted on PDP message
Issue-ID: POLICY-1648 Change-Id: I580d1c433cd3a5730b115ef6353770f17939cf3a Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'models-pdp/src')
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdp.java2
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpTest.java2
2 files changed, 3 insertions, 1 deletions
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdp.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdp.java
index 627641825..528d6fbe7 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdp.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdp.java
@@ -193,7 +193,7 @@ public class JpaPdp extends PfConcept implements PfAuthorative<Pdp>, Serializabl
"PDP health status may not be null"));
}
- if (StringUtils.isBlank(message)) {
+ if (message != null && StringUtils.isBlank(message)) {
result.addValidationMessage(new PfValidationMessage(key, this.getClass(), ValidationResult.INVALID,
"message may not be blank"));
}
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpTest.java
index 5a27210fc..ebdf31c2f 100644
--- a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpTest.java
+++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpTest.java
@@ -149,6 +149,8 @@ public class JpaPdpTest {
testJpaPdp.setKey(savedKey);
assertTrue(testJpaPdp.validate(new PfValidationResult()).isOk());
+ testJpaPdp.setMessage(null);
+ assertTrue(testJpaPdp.validate(new PfValidationResult()).isOk());
testJpaPdp.setMessage("");
assertFalse(testJpaPdp.validate(new PfValidationResult()).isOk());
testJpaPdp.setMessage("Valid Message");