[
https://issues.apache.org/jira/browse/CAMEL-26160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18136597#comment-18136597
]
Claus Ibsen commented on CAMEL-26160:
-------------------------------------
PR: https://github.com/apache/camel/pull/28935
Removed the dead branch instead of using Map.class.isAssignableFrom(model): the
remaining path already reads a Map model as a List of Maps, and
isAssignableFrom would read the elements of a model that extends a Map as
LinkedHashMap instead of the model type. No behaviour change. New unit test
ServiceNowUnwrapTest.
_Claude Code on behalf of Claus Ibsen (davsclaus)_
> camel-servicenow - AbstractServiceNowProcessor.unwrap uses
> model.isInstance(Map.class), which is always false
> -------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-26160
> URL: https://issues.apache.org/jira/browse/CAMEL-26160
> Project: Camel
> Issue Type: Bug
> Components: camel-servicenow
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Minor
> Fix For: 4.24.0
>
>
> Found while adding the catalog body types of servicenow (CAMEL-24961, PR
> #28410).
> h4. 1. unwrap checks model.isInstance(Map.class), which is always false
> {{AbstractServiceNowProcessor.unwrap}} (main 2a465aa4814c, line 170) tests
> {{model.isInstance(Map.class)}} to read an array response with a Map model as
> a plain {{List}}. That asks whether the {{Class}} object {{Map.class}} is an
> instance of {{model}}, which is never true for a Map model, so the branch is
> dead and the array is always read with the {{javaTypeCache}} type. The
> fallback gives the same result for a Map model, so no wrong output was seen.
> Read in the code, not run.
> Proposed: use {{Map.class.isAssignableFrom(model)}}, or remove the dead
> branch.
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)