Trim string attrubutes of JPA entries (#2597)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -99,12 +99,12 @@ public class ObjectCopyUtil {
|
|||||||
final Order order = toSetterMethod.getAnnotation(Order.class);
|
final Order order = toSetterMethod.getAnnotation(Order.class);
|
||||||
return new ToSetter((to, value) -> {
|
return new ToSetter((to, value) -> {
|
||||||
try {
|
try {
|
||||||
toSetterMethod.invoke(to, value);
|
toSetterMethod.invoke(to, value instanceof String str ? str.trim() : value);
|
||||||
} catch (final InvocationTargetException e) {
|
} catch (final InvocationTargetException e) {
|
||||||
final Throwable targetException = e.getTargetException() == null ? e : e.getTargetException();
|
final Throwable targetException = e.getTargetException() == null ? e : e.getTargetException();
|
||||||
throw targetException instanceof RuntimeException re
|
throw targetException instanceof RuntimeException re
|
||||||
? re :
|
? re
|
||||||
new IllegalStateException("Error invoking " + toSetterMethod, targetException);
|
: new IllegalStateException("Error invoking " + toSetterMethod, targetException);
|
||||||
} catch (final IllegalAccessException | IllegalArgumentException e) {
|
} catch (final IllegalAccessException | IllegalArgumentException e) {
|
||||||
throw new IllegalStateException("Error invoking " + toSetterMethod, e);
|
throw new IllegalStateException("Error invoking " + toSetterMethod, e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user