This is an automated email from the ASF dual-hosted git repository.

jayblanc pushed a commit to branch UNOMI-945
in repository https://gitbox.apache.org/repos/asf/unomi.git

commit f32d44c912c2edc6e37f166cd2c4107f750db9a6
Author: Jérôme Blanchard <[email protected]>
AuthorDate: Fri Jun 19 10:31:03 2026 +0200

    fix: return the filtered list in the ContextJsonEndpoint
---
 .../apache/unomi/rest/endpoints/ContextJsonEndpoint.java    | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git 
a/rest/src/main/java/org/apache/unomi/rest/endpoints/ContextJsonEndpoint.java 
b/rest/src/main/java/org/apache/unomi/rest/endpoints/ContextJsonEndpoint.java
index a50ea7592..a05d26396 100644
--- 
a/rest/src/main/java/org/apache/unomi/rest/endpoints/ContextJsonEndpoint.java
+++ 
b/rest/src/main/java/org/apache/unomi/rest/endpoints/ContextJsonEndpoint.java
@@ -349,19 +349,18 @@ public class ContextJsonEndpoint {
             } else {
                 return stringValue;
             }
-        } else if (value instanceof List) {
-            List values = (List) value;
-            List newValues = new ArrayList();
+        } else if (value instanceof List values) {
+            List newValues = new ArrayList(values.size());
             for (Object listObject : values) {
                 Object newObject = sanitizeValue(listObject);
                 if (newObject != null) {
                     newValues.add(newObject);
                 }
             }
-            return values;
-        } else if (value instanceof Map) {
-            Map<Object, Object> newMap = new LinkedHashMap<>();
-            ((Map<?, ?>) value).forEach((key, value1) -> {
+            return newValues;
+        } else if (value instanceof Map values) {
+            Map<Object, Object> newMap = new LinkedHashMap<>(values.size());
+            values.forEach((key, value1) -> {
                 Object newObject = sanitizeValue(value1);
                 if (newObject != null) {
                     newMap.put(key, newObject);

Reply via email to