[ 
https://issues.apache.org/jira/browse/CAMEL-11139?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Thomas Diesler updated CAMEL-11139:
-----------------------------------
    Description: 
[ProducerCache.doInProducer()|https://github.com/apache/camel/blob/master/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java#L348]
 may be called with null exchange. 

The javadoc says

{code}
    /**
     * Sends an exchange to an endpoint using a supplied callback, using the 
synchronous processing.
     * <p/>
     * If an exception was thrown during processing, it would be set on the 
given Exchange
     *
     * @param endpoint  the endpoint to send the exchange to
     * @param exchange  the exchange, can be <tt>null</tt> if so then create a 
new exchange from the producer
     * @param pattern   the exchange pattern, can be <tt>null</tt>
     * @param callback  the callback
     * @return the response from the callback
     * @see #doInAsyncProducer(org.apache.camel.Endpoint, 
org.apache.camel.Exchange, org.apache.camel.ExchangePattern, 
org.apache.camel.AsyncCallback, org.apache.camel.AsyncProducerCallback)
     */
    public <T> T doInProducer(Endpoint endpoint, Exchange exchange, 
ExchangePattern pattern, ProducerCallback<T> callback) {
{code}

The exchange is however never created, which may result in a null return from 
ProducerTemplate and a possible exception silently being ignored.

  was:
ProducerCache.doInProducer() may be called with null exchange. The javadoc says

{code}
    /**
     * Sends an exchange to an endpoint using a supplied callback, using the 
synchronous processing.
     * <p/>
     * If an exception was thrown during processing, it would be set on the 
given Exchange
     *
     * @param endpoint  the endpoint to send the exchange to
     * @param exchange  the exchange, can be <tt>null</tt> if so then create a 
new exchange from the producer
     * @param pattern   the exchange pattern, can be <tt>null</tt>
     * @param callback  the callback
     * @return the response from the callback
     * @see #doInAsyncProducer(org.apache.camel.Endpoint, 
org.apache.camel.Exchange, org.apache.camel.ExchangePattern, 
org.apache.camel.AsyncCallback, org.apache.camel.AsyncProducerCallback)
     */
    public <T> T doInProducer(Endpoint endpoint, Exchange exchange, 
ExchangePattern pattern, ProducerCallback<T> callback) {
{code}

The exchange is however never created, which may result in a null return from 
ProducerTemplate and a possible exception silently being ignored.


> Exchange not created in ProducerCache
> -------------------------------------
>
>                 Key: CAMEL-11139
>                 URL: https://issues.apache.org/jira/browse/CAMEL-11139
>             Project: Camel
>          Issue Type: Bug
>    Affects Versions: 2.18.3
>            Reporter: Thomas Diesler
>            Assignee: Thomas Diesler
>             Fix For: 2.18.4, 2.19.0
>
>
> [ProducerCache.doInProducer()|https://github.com/apache/camel/blob/master/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java#L348]
>  may be called with null exchange. 
> The javadoc says
> {code}
>     /**
>      * Sends an exchange to an endpoint using a supplied callback, using the 
> synchronous processing.
>      * <p/>
>      * If an exception was thrown during processing, it would be set on the 
> given Exchange
>      *
>      * @param endpoint  the endpoint to send the exchange to
>      * @param exchange  the exchange, can be <tt>null</tt> if so then create 
> a new exchange from the producer
>      * @param pattern   the exchange pattern, can be <tt>null</tt>
>      * @param callback  the callback
>      * @return the response from the callback
>      * @see #doInAsyncProducer(org.apache.camel.Endpoint, 
> org.apache.camel.Exchange, org.apache.camel.ExchangePattern, 
> org.apache.camel.AsyncCallback, org.apache.camel.AsyncProducerCallback)
>      */
>     public <T> T doInProducer(Endpoint endpoint, Exchange exchange, 
> ExchangePattern pattern, ProducerCallback<T> callback) {
> {code}
> The exchange is however never created, which may result in a null return from 
> ProducerTemplate and a possible exception silently being ignored.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to