amalsaidov opened a new pull request, #24207:
URL: https://github.com/apache/kafka/pull/24207

   The `Cast` SMT validates its `spec` config in `parseFieldTypes`. When a
   spec entry has more than one colon (for example `foo:int8:extra`), the
   code threw a `ConfigException` that had been copy-pasted from
   `ReplaceField`:
   
   ```java
   throw new ConfigException(ReplaceField.ConfigName.RENAMES, mappings, 
"Invalid rename mapping: " + mapping);
   ```
   
   For a Cast user the resulting message is misleading:
   
   ```
   Invalid value [foo:int8:extra] for configuration renames: Invalid rename 
mapping: foo:int8:extra
   ```
   
   Cast has no `renames` config, and the entry is a casting spec, not a
   rename mapping. This change points the error at the Cast `spec` config
   and describes the problem in terms of the casting spec, which also drops
   the only reference from `Cast` to `ReplaceField.ConfigName`.
   
   The existing `CastTest.testConfigInvalidMap` already exercised this path
   but only checked that some `ConfigException` was thrown, so it did not
   catch the wrong text. I extended it to assert the message references the
   `spec` config and no longer mentions rename mappings.
   
   Testing: `./gradlew :connect:transforms:test --tests 
'org.apache.kafka.connect.transforms.CastTest'` passes. The updated test fails 
against the old message and passes with the fix. `checkstyleTest` and 
`spotlessJavaCheck` for the module pass.
   
   AI-assisted; directed, reviewed and tested by the author (amalsaidov).


-- 
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]

Reply via email to