davsclaus opened a new pull request, #28935: URL: https://github.com/apache/camel/pull/28935
Fixes [CAMEL-26160](https://issues.apache.org/jira/browse/CAMEL-26160). ### What was wrong `AbstractServiceNowProcessor.unwrap` tested `model.isInstance(Map.class)` before reading an array `result` as a plain `List`. That asks whether the `Class` object `Map.class` is an instance of the model, which is never true. So the branch was dead, and every array was read with the `javaTypeCache` type (`List<model>`). ### What changed The dead branch is removed. The remaining path already handles a Map model: it reads `List<Map>`, which gives the same `ArrayList` of `LinkedHashMap` the dead branch meant to produce. There is no behaviour change. I did not use `Map.class.isAssignableFrom(model)` (the other option in the JIRA). For a model that extends a Map (e.g. `class Incident extends HashMap<String, Object>`) it would read the elements as `LinkedHashMap` instead of the model type. That would be a regression. ### Tests New `ServiceNowUnwrapTest` (unit test, no ServiceNow instance needed) covers `unwrap` for an array with a Map model, a Map subclass model, a POJO model and a String model, and for a single object with a Map model. - The tests pass on main too, since the old branch was dead and the fix has no visible effect. - With the `isAssignableFrom` variant, `testArrayWithMapSubclassModel` fails (`expected IncidentMap but was LinkedHashMap`). So the test guards against that change. `mvn clean install -Psourcecheck` in the module: 5 unit tests pass; the 20 ITs are skipped, as before, without ServiceNow credentials. No docs, generated files or upgrade guide entry: there is no behaviour change. _Claude Code on behalf of Claus Ibsen (davsclaus)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
