[
https://issues.apache.org/jira/browse/CAMEL-26163?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18136601#comment-18136601
]
Claus Ibsen commented on CAMEL-26163:
-------------------------------------
PR: https://github.com/apache/camel/pull/28939
A JSON text (String, byte[] or InputStream) or a Map body is now converted to
Post / User with Jackson in the post and user producers. Any other body fails
with an InvalidPayloadException that names the type, instead of the bare
NullPointerException. Catalog body types and the component doc are updated.
_Claude Code on behalf of Claus Ibsen (davsclaus)_
> camel-wordpress - a JSON text or Map body to create or update a post or user
> fails with a bare NullPointerException
> -------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-26163
> URL: https://issues.apache.org/jira/browse/CAMEL-26163
> Project: Camel
> Issue Type: Bug
> Components: camel-wordpress
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Minor
> Fix For: 4.24.0
>
>
> Found while adding the catalog body types of wordpress (CAMEL-24961, PR
> #28410).
> h4. 1. A JSON text or Map body gives a bare NullPointerException
> {{WordpressPostProducer}} (main 2a465aa4814c, lines 43 and 49) and
> {{WordpressUserProducer}} (lines 46 and 52) read the body with
> {{getBody(Post.class)}} / {{getBody(User.class)}}. There is no converter from
> a JSON String or a {{Map}}, so the result is null and
> {{AbstractWordpressCrudServiceAdapter.create}} / {{update}} (lines 41 and 76)
> throw {{NullPointerException: Please define an object to create}}, which does
> not say that the body type is wrong. Checked on 4.24.0-SNAPSHOT with the
> module's mock server.
> Proposed: use {{getMandatoryBody(Post.class)}} /
> {{getMandatoryBody(User.class)}} so the error names the body type, and
> optionally convert a JSON String or Map to {{Post}} / {{User}} with Jackson.
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)