From e2beb898f84ccd1656093cd437aa4851c98d4c8d Mon Sep 17 00:00:00 2001 From: Avgustin Marinov Date: Thu, 7 Aug 2025 12:07:19 +0300 Subject: [PATCH] Trim string attrubutes of JPA entries (#2597) Signed-off-by: Avgustin Marinov --- .../main/java/org/eclipse/hawkbit/utils/ObjectCopyUtil.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hawkbit-core/src/main/java/org/eclipse/hawkbit/utils/ObjectCopyUtil.java b/hawkbit-core/src/main/java/org/eclipse/hawkbit/utils/ObjectCopyUtil.java index 77a9efa46..7a0a690da 100644 --- a/hawkbit-core/src/main/java/org/eclipse/hawkbit/utils/ObjectCopyUtil.java +++ b/hawkbit-core/src/main/java/org/eclipse/hawkbit/utils/ObjectCopyUtil.java @@ -99,12 +99,12 @@ public class ObjectCopyUtil { final Order order = toSetterMethod.getAnnotation(Order.class); return new ToSetter((to, value) -> { try { - toSetterMethod.invoke(to, value); + toSetterMethod.invoke(to, value instanceof String str ? str.trim() : value); } catch (final InvocationTargetException e) { final Throwable targetException = e.getTargetException() == null ? e : e.getTargetException(); throw targetException instanceof RuntimeException re - ? re : - new IllegalStateException("Error invoking " + toSetterMethod, targetException); + ? re + : new IllegalStateException("Error invoking " + toSetterMethod, targetException); } catch (final IllegalAccessException | IllegalArgumentException e) { throw new IllegalStateException("Error invoking " + toSetterMethod, e); }