DBZ-5946 Print the readable data class name in JdbcValueConverters.handleUnknownData

This commit is contained in:
harveyyue 2022-12-17 15:41:42 +08:00 committed by Jiri Pechanec
parent bae49fec2a
commit 348e77d334

View File

@ -1276,17 +1276,18 @@ else if (data instanceof Long) {
* @throws IllegalArgumentException if the value could not be converted but the column does not allow nulls
*/
protected Object handleUnknownData(Column column, Field fieldDefn, Object data) {
if (column.isOptional() || fieldDefn.schema().isOptional()) {
Class<?> dataClass = data.getClass();
String clazzName = dataClass.isArray() ? dataClass.getSimpleName() : dataClass.getName();
if (column.isOptional() || fieldDefn.schema().isOptional()) {
if (logger.isWarnEnabled()) {
logger.warn("Unexpected value for JDBC type {} and column {}: class={}", column.jdbcType(), column,
dataClass.isArray() ? dataClass.getSimpleName() : dataClass.getName()); // don't include value in case its
// sensitive
clazzName); // don't include value in case its sensitive
}
return null;
}
throw new IllegalArgumentException("Unexpected value for JDBC type " + column.jdbcType() + " and column " + column +
": class=" + data.getClass()); // don't include value in case its sensitive
": class=" + clazzName); // don't include value in case its sensitive
}
protected int getTimePrecision(Column column) {