diff --git a/src/main/java/it/gov/pagopa/node/cfgsync/util/Utils.java b/src/main/java/it/gov/pagopa/node/cfgsync/util/Utils.java index 98ea408..d4a196f 100644 --- a/src/main/java/it/gov/pagopa/node/cfgsync/util/Utils.java +++ b/src/main/java/it/gov/pagopa/node/cfgsync/util/Utils.java @@ -27,7 +27,7 @@ public static Object trimValueColumn(Class clazz, String columnName, String valu try { int maxColumnLength = clazz.getDeclaredField(columnName).getAnnotation(Column.class).length(); int valueLength = value.length(); - int lastIndexTrim = valueLength > maxColumnLength ? maxColumnLength : valueLength; + int lastIndexTrim = Math.min(valueLength, maxColumnLength); return value.substring(0, lastIndexTrim); } catch (NoSuchFieldException e) { throw new SyncDbStatusException(e.getMessage());