aboutsummaryrefslogtreecommitdiffstats
path: root/cps-service/src/main/java/org/onap
diff options
context:
space:
mode:
authorsourabh_sourabh <sourabh.sourabh@est.tech>2024-06-19 14:35:30 +0100
committersourabh_sourabh <sourabh.sourabh@est.tech>2024-06-19 15:16:41 +0100
commit5c14b4b3167e13579fa20bd6632c82d0dd7d0844 (patch)
treec01a3948e30c5e406438c687db4d18633cc167a7 /cps-service/src/main/java/org/onap
parentd16143ab60f0bb75d7d1666f1bd198fc651d8ab0 (diff)
Addressed an adaptability issue
- Defined a constant instead of duplicating literal "No data nodes 4 times. Issue-ID: CPS-478 Change-Id: I2b980a228217e85424342d4c2b9e97c5cfa618d1 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
Diffstat (limited to 'cps-service/src/main/java/org/onap')
-rw-r--r--cps-service/src/main/java/org/onap/cps/api/impl/CpsDataServiceImpl.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/cps-service/src/main/java/org/onap/cps/api/impl/CpsDataServiceImpl.java b/cps-service/src/main/java/org/onap/cps/api/impl/CpsDataServiceImpl.java
index 6386d38ffc..5a48428772 100644
--- a/cps-service/src/main/java/org/onap/cps/api/impl/CpsDataServiceImpl.java
+++ b/cps-service/src/main/java/org/onap/cps/api/impl/CpsDataServiceImpl.java
@@ -65,6 +65,7 @@ public class CpsDataServiceImpl implements CpsDataService {
private static final String ROOT_NODE_XPATH = "/";
private static final long DEFAULT_LOCK_TIMEOUT_IN_MILLISECONDS = 300L;
+ private static final String NO_DATA_NODES = "No data nodes.";
private final CpsDataPersistenceService cpsDataPersistenceService;
private final CpsDataUpdateEventsService cpsDataUpdateEventsService;
@@ -425,7 +426,7 @@ public class CpsDataServiceImpl implements CpsDataService {
.withContainerNode(containerNode)
.buildCollection();
if (dataNodes.isEmpty()) {
- throw new DataValidationException("No data nodes.", "No data nodes provided");
+ throw new DataValidationException(NO_DATA_NODES, "No data nodes provided");
}
return dataNodes;
}
@@ -437,7 +438,7 @@ public class CpsDataServiceImpl implements CpsDataService {
.withContainerNode(containerNode)
.buildCollection();
if (dataNodes.isEmpty()) {
- throw new DataValidationException("No data nodes.", "No data nodes provided");
+ throw new DataValidationException(NO_DATA_NODES, "No data nodes provided");
}
return dataNodes;
}
@@ -453,8 +454,7 @@ public class CpsDataServiceImpl implements CpsDataService {
.withContainerNode(containerNode)
.buildCollection();
if (dataNodes.isEmpty()) {
- throw new DataValidationException("No data nodes.",
- "Data nodes were not found under the xpath " + xpath);
+ throw new DataValidationException(NO_DATA_NODES, "Data nodes were not found under the xpath " + xpath);
}
return dataNodes;
}
@@ -466,7 +466,7 @@ public class CpsDataServiceImpl implements CpsDataService {
.withContainerNode(containerNode)
.buildCollection();
if (dataNodes.isEmpty()) {
- throw new DataValidationException("No data nodes.", "Data nodes were not found under the xpath " + xpath);
+ throw new DataValidationException(NO_DATA_NODES, "Data nodes were not found under the xpath " + xpath);
}
return dataNodes;
}