You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Thomas Papke (JIRA)" <ji...@apache.org> on 2017/10/26 07:48:00 UTC

[jira] [Created] (CAMEL-11948) NPE on DefaultMessage setBody if deprecated constructor was used

Thomas Papke created CAMEL-11948:
------------------------------------

             Summary: NPE on DefaultMessage setBody if deprecated constructor was used
                 Key: CAMEL-11948
                 URL: https://issues.apache.org/jira/browse/CAMEL-11948
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 2.20.0
            Reporter: Thomas Papke


After upgrade camel 2.20.0, some operations fail with a NullPointerException:
{code}
Caused by: java.lang.NullPointerException
        at org.apache.camel.impl.MessageSupport.setBody(MessageSupport.java:122)
{code}

The issue seems to be introduced with the change CAMEL-11380.

The issue could be easily reproduced by using the deprecated constructor, where no camelContext is set:
{code}
        Message message = new DefaultMessage();
        message.setBody("something");
{code}

To remain better backward compatibility, i would suggest a nullcheck in the setBody for cases where the CamelContext is not set.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)