summaryrefslogtreecommitdiffstats
path: root/cps-path-parser
diff options
context:
space:
mode:
authordanielhanrahan <daniel.hanrahan@est.tech>2024-10-02 21:31:04 +0100
committerdanielhanrahan <daniel.hanrahan@est.tech>2024-10-03 21:04:09 +0100
commit153aa48c6945cfc54ceb1b3f6a38508ad93f1d16 (patch)
tree9b4510292b2efd1e11d34f4493d7604ea98d2172 /cps-path-parser
parent2686ec95a09bafa2846860d403516f89cb2ed0c0 (diff)
[BUG] Fix memory leak related to using arrays in Hibernate
The use of arrays like String[] instead of Collection<String> in JpaRepository methods is causing a memory leak, most likely due to a bug in the hypersistence-utils dependency which provides the feature. Note code using arrays in JDBC (via jdbcTemplate) is not affected. This patch removes most uses of arrays in Java, except one needed for FragmentPrefetchRepository using JDBC setArray(), which is safe. Issue-ID: CPS-2430 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: I94f8c3d4c8c32ebe0978c08d3226a196a95bf3b9
Diffstat (limited to 'cps-path-parser')
-rw-r--r--cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathUtil.java8
1 files changed, 3 insertions, 5 deletions
diff --git a/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathUtil.java b/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathUtil.java
index bde9b0638f..4ede0d9c90 100644
--- a/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathUtil.java
+++ b/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathUtil.java
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2022-2023 Nordix Foundation
+ * Copyright (C) 2022-2024 Nordix Foundation
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -59,12 +59,10 @@ public class CpsPathUtil {
return getCpsPathBuilder(xpathSource).build().getNormalizedParentPath();
}
- public static String[] getXpathNodeIdSequence(final String xpathSource) {
- final List<String> containerNames = getCpsPathBuilder(xpathSource).build().getContainerNames();
- return containerNames.toArray(new String[containerNames.size()]);
+ public static List<String> getXpathNodeIdSequence(final String xpathSource) {
+ return getCpsPathBuilder(xpathSource).build().getContainerNames();
}
-
/**
* Returns boolean indicating xpath is an absolute path to a list element.
*