Trim string attrubutes of JPA entries (#2597)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2025-08-07 12:07:19 +03:00
committed by GitHub
parent b3e32c14b6
commit e2beb898f8

View File

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