Skip to content

Commit 5973e6b

Browse files
committed
address comments and throw an exception
1 parent 38efb1d commit 5973e6b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

fluss-client/src/main/java/com/alibaba/fluss/client/utils/ConverterUtils.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -490,10 +490,10 @@ public GenericRow toRow(T pojo) {
490490
try {
491491
value = fieldToRowConverters[i].convert(pojo);
492492
} catch (IllegalAccessException e) {
493-
LOG.warn(
494-
"Failed to access field {} in POJO class {}.",
495-
rowType.getFieldNames().get(i),
496-
pojoClass.getName(),
493+
throw new IllegalStateException(
494+
String.format(
495+
"Failed to access field '%s' in POJO class %s while converting to row. Ensure the field is accessible.",
496+
rowType.getFieldNames().get(i), pojoClass.getName()),
497497
e);
498498
}
499499
row.setField(i, value);
@@ -524,10 +524,10 @@ public T fromRow(InternalRow row) {
524524
pojoFields[i].set(pojo, value);
525525
}
526526
} catch (IllegalAccessException e) {
527-
LOG.warn(
528-
"Failed to set field {} in POJO class {}.",
529-
rowType.getFieldNames().get(i),
530-
pojoClass.getName(),
527+
throw new IllegalStateException(
528+
String.format(
529+
"Failed to set field '%s' in POJO class %s while converting from row. Ensure the field is accessible and not final.",
530+
rowType.getFieldNames().get(i), pojoClass.getName()),
531531
e);
532532
}
533533
}

0 commit comments

Comments
 (0)