camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CAMEL-9805) camel-sql - body not copied from in to out when useing outputHeader and outputType=SelectOne when sql doesn't return a result
Date Sun, 10 Apr 2016 06:10:25 GMT

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

Claus Ibsen updated CAMEL-9805:
-------------------------------
    Fix Version/s: 2.18.0
                   2.17.1

> camel-sql - body not copied from in to out when useing outputHeader and outputType=SelectOne
when sql doesn't return a result
> -----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-9805
>                 URL: https://issues.apache.org/jira/browse/CAMEL-9805
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-sql
>    Affects Versions: 2.17.0
>            Reporter: Thomas Bender
>            Assignee: Andrea Cosentino
>             Fix For: 2.17.1, 2.18.0
>
>         Attachments: CamelSqlComponentTest.java, db-camel-data.sql, db-camel-schema.sql
>
>
> When using the options outputHeader and outputType=SelectOne the body of the Exchange
is not copied from in to out when the select returns no data..
> Probably root is line 175-185 of SqlProducer.java that is missing an else for the above
mentioned case.
> {code}
> if (data != null) { // <--- Missing the else
> // for noop=true we still want to enrich with the row count header
>   if (getEndpoint().isNoop()) {
>     exchange.getOut().setBody(exchange.getIn().getBody());
>   } else if (getEndpoint().getOutputHeader() != null) {
>     exchange.getOut().setBody(exchange.getIn().getBody());
>     exchange.getOut().setHeader(getEndpoint().getOutputHeader(), data);
>   } else {
>     exchange.getOut().setBody(data); 
>   }
>   exchange.getOut().setHeader(SqlConstants.SQL_ROW_COUNT, 1);
> }
> {code}
> following could be added (untested)
> {code}
> else { // if data == null
> if (getEndpoint().isNoop()) {
>                                         exchange.getOut().setBody(exchange.getIn().getBody());
>                                     } else if (getEndpoint().getOutputHeader() != null)
{
>                                         exchange.getOut().setBody(exchange.getIn().getBody());
>                                     }
>  exchange.getOut().setHeader(SqlConstants.SQL_ROW_COUNT, 0);
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message