[
https://issues.apache.org/jira/browse/CAMEL-26196?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18136900#comment-18136900
]
Claus Ibsen commented on CAMEL-26196:
-------------------------------------
PR: https://github.com/apache/camel/pull/29024
All three are fixed. A pojoRequest body of another type is converted (type
converter, or a Map or JSON text) and fails with an InvalidPayloadException
when it does not convert. A create or delete that gives a Response now fails
with a WebApplicationException on a status other than 2xx, and the Response is
closed (its status and Location header can still be read). The elements of the
bulkCreateUsers and bulkUpdateUsers list are converted the same way.
bulkCreateUsers and bulkDeleteUsers no longer count a 409 or 404 as a success.
Upgrade guide entry added.
_Claude Code on behalf of Claus Ibsen (davsclaus)_
> camel-keycloak - with pojoRequest a body of the wrong type does nothing and
> no error, and a failed create or delete is not an error and its Response is
> never closed
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-26196
> URL: https://issues.apache.org/jira/browse/CAMEL-26196
> Project: Camel
> Issue Type: Bug
> Components: camel-keycloak
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Major
> Fix For: 4.24.0
>
>
> Found while adding the catalog body types of keycloak (CAMEL-24961, PR
> #28416).
> h4. 1. pojoRequest=true with a body of the wrong type does nothing
> With {{pojoRequest=true}}, {{KeycloakProducer.createUser}} (main
> 2a465aa4814c, line 514 to 520) calls Keycloak only when the body is a
> {{UserRepresentation}}; for a String or a Map body (for example JSON) there
> is no call, no error, and the body is unchanged. The other pojoRequest
> operations use the same {{instanceof}} pattern. Checked on 4.24.0-SNAPSHOT
> with Keycloak 26.8.1 from test-infra (docker).
> Proposed: convert the body to the expected representation (mandatory), and
> fail with a clear error when it does not convert.
> h4. 2. A failed create or delete is not an error, and its Response is never
> closed
> createUser (line 517 to 519), deleteUser (line 557 to 559) and the other
> creates set the jakarta {{Response}} as the body without looking at its
> status: a 409 (already exists) or a 404 (not found) completes the exchange as
> a success. The Response is never closed. Checked on 4.24.0-SNAPSHOT with
> Keycloak from test-infra.
> Proposed: fail the exchange on a non-2xx status, and read what is needed from
> the Response (status, location, created id) and close it.
> h4. 3. bulkCreateUsers with a List of Map fails with a raw ClassCastException
> {{KeycloakProducer.bulkCreateUsers}} (line 2337 to 2339) casts a List body to
> {{List<UserRepresentation>}}; a List of Map (from JSON unmarshalling) then
> fails with a raw ClassCastException when the elements are used. Checked on
> 4.24.0-SNAPSHOT with Keycloak from test-infra.
> Proposed: convert each element to UserRepresentation, or fail with an error
> that names the expected element type.
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)