davsclaus commented on code in PR #29225:
URL: https://github.com/apache/camel/pull/29225#discussion_r4481368367
##########
components/camel-debezium/camel-debezium-common/camel-debezium-maven-plugin/src/main/java/org/apache/camel/maven/config/ConnectorConfigGenerator.java:
##########
@@ -155,6 +176,19 @@ public String toString() {
return printClassAsString();
}
+ private static Field getConfigClassField(final Class<?> configClass, final
String name) {
+ try {
+ if (configClass.getField(name).get(null) instanceof Field field) {
Review Comment:
Fixed in 7cc03700d572: `getConfigClassField` now checks
`Modifier.isStatic()` before `get(null)` and fails with a clear
`IllegalArgumentException` when the field is not static.
_Claude Code on behalf of Claus Ibsen (davsclaus)_
##########
components/camel-debezium/camel-debezium-common/camel-debezium-maven-plugin/src/main/java/org/apache/camel/maven/config/ConnectorConfigGenerator.java:
##########
@@ -155,6 +176,19 @@ public String toString() {
return printClassAsString();
}
+ private static Field getConfigClassField(final Class<?> configClass, final
String name) {
+ try {
+ if (configClass.getField(name).get(null) instanceof Field field) {
+ return field;
+ }
+ } catch (ReflectiveOperationException e) {
+ throw new IllegalArgumentException(
+ String.format("Class '%s' has no public static field
'%s'", configClass.getName(), name), e);
+ }
+ throw new IllegalArgumentException(
+ String.format("Field '%s' of class '%s' is not a Debezium
Field", name, configClass.getName()));
+ }
Review Comment:
Fixed in 7cc03700d572: `getConfigClassField` now checks
`Modifier.isStatic()` before `get(null)` and fails with a clear
`IllegalArgumentException` when the field is not static.
_Claude Code on behalf of Claus Ibsen (davsclaus)_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]