Claus Ibsen created CAMEL-26163:
-----------------------------------

             Summary: 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
             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)

Reply via email to