[
https://issues.apache.org/jira/browse/CAMEL-7589?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen updated CAMEL-7589:
-------------------------------
Issue Type: Improvement (was: Bug)
> Missing 'null' check in methods sendBodyAndHeaders() of class
> DefaultProducerTemplate
> -------------------------------------------------------------------------------------
>
> Key: CAMEL-7589
> URL: https://issues.apache.org/jira/browse/CAMEL-7589
> Project: Camel
> Issue Type: Improvement
> Components: camel-core
> Affects Versions: 2.10.7, 2.13.2
> Environment: Windows XP 32bits
> Java 6 (update 38)
> Reporter: Concombre Masqué
> Priority: Minor
> Fix For: 2.14.0
>
>
> In class DefaultProducerTemplate, in methods :
> - public void sendBodyAndHeaders(Endpoint endpoint, final Object body, final
> Map<String, Object> headers)
> - public Object sendBodyAndHeaders(Endpoint endpoint, ExchangePattern
> pattern, final Object body, final Map<String, Object> headers)
> Passing 'null' as last parameter (headers) should be allowed and handled
> correctly.
> A simple check is to be added before entering the 'for' loop:
> if(headers != null) {
> for (Map.Entry<String, Object> header : headers.entrySet()) {
> in.setHeader(header.getKey(), header.getValue());
> }
> }
> With current implementation an exception is raised:
> Caused by: java.lang.NullPointerException
> at
> org.apache.camel.impl.DefaultProducerTemplate$2.process(DefaultProducerTemplate.java:241)
> at
> org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:346)
> at
> org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:337)
> at
> org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:233)
> at
> org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:337)
> at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:192)
> at
> org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:115)
> at
> org.apache.camel.impl.DefaultProducerTemplate.sendBodyAndHeaders(DefaultProducerTemplate.java:238)
--
This message was sent by Atlassian JIRA
(v6.2#6252)