camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "wu wen (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CAMEL-7589) Missing 'null' check in methods sendBodyAndHeaders() of class DefaultProducerTemplate
Date Sun, 17 Aug 2014 16:17:18 GMT

    [ https://issues.apache.org/jira/browse/CAMEL-7589?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14099978#comment-14099978
] 

wu wen commented on CAMEL-7589:
-------------------------------

https://github.com/apache/camel/pull/240

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

Mime
View raw message