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 * @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) { protected Object handleUnknownData(Column column, Field fieldDefn, Object data) {
Class<?> dataClass = data.getClass();
String clazzName = dataClass.isArray() ? dataClass.getSimpleName() : dataClass.getName();
if (column.isOptional() || fieldDefn.schema().isOptional()) { if (column.isOptional() || fieldDefn.schema().isOptional()) {
Class<?> dataClass = data.getClass();
if (logger.isWarnEnabled()) { if (logger.isWarnEnabled()) {
logger.warn("Unexpected value for JDBC type {} and column {}: class={}", column.jdbcType(), column, 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 clazzName); // don't include value in case its sensitive
// sensitive
} }
return null; return null;
} }
throw new IllegalArgumentException("Unexpected value for JDBC type " + column.jdbcType() + " and column " + column + 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) { protected int getTimePrecision(Column column) {