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); }