[
https://issues.apache.org/jira/browse/CAMEL-26171?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Work on CAMEL-26171 started by Claus Ibsen.
-------------------------------------------
> camel-xchange - the option currency=BTC fails with no type converter, and a
> String currency pair body or header is not converted
> --------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-26171
> URL: https://issues.apache.org/jira/browse/CAMEL-26171
> Project: Camel
> Issue Type: Bug
> Components: camel-xchange
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Minor
> Fix For: 4.24.0
>
>
> Found while adding the catalog body types of xchange (CAMEL-24961, PR #28412).
> h4. 1. The endpoint option currency=BTC fails with no type converter
> The generated {{XChangeEndpointConfigurer}} (line 26) sets {{currency}} with
> {{setCurrency(Currency)}} after converting the value to
> {{org.knowm.xchange.currency.Currency}}, and there is no String to Currency
> converter, so
> {{xchange:binance?service=metadata&method=currencyMetaData¤cy=BTC}}
> fails with "No type converter available to convert from type:
> java.lang.String to the required type: org.knowm.xchange.currency.Currency".
> The {{setCurrency(String)}} setter in {{XChangeConfiguration}} (line 102) is
> never used. Checked on 4.24.0-SNAPSHOT with a fake {{Exchange}} (dynamic
> proxy) set with {{putXChange}}.
> Proposed: add a String to {{Currency}} type converter (or make the option a
> String as {{currencyPair}} is).
> h4. 2. A String body or header with a currency pair or currency is not
> converted
> {{XChangeMarketDataProducer.process}} (main 2a465aa4814c, lines 45-46) and
> {{XChangeMetaDataProducer.process}} (lines 52-53 and 58-59) read the
> {{CamelXChangeCurrencyPair}} / {{CamelXChangeCurrency}} header and then the
> body as {{CurrencyPair}} / {{Currency}}. A String such as {{"BTC/USDT"}} or
> {{"USDT"}} is not converted, so the call fails with "Null currency pair" or
> "Null currency". Checked on 4.24.0-SNAPSHOT with the fake {{Exchange}}.
> Proposed: add String to {{CurrencyPair}} ({{new CurrencyPair(String)}}) and
> String to {{Currency}} type converters.
> h4. 3. currencyPairMetaData with no pair reports "Null currency"
> {{XChangeEndpoint.getCurrencyPairMetaData}} (main 2a465aa4814c, line 132)
> uses {{Assert.notNull(pair, "Null currency")}}, so a missing pair is reported
> as a missing currency. Read in the code, not run.
> Proposed: use the message "Null currency pair".
> h4. 4. A method of another service silently does nothing
> Each producer only handles its own methods: for example
> {{XChangeMarketDataProducer.process}} (line 44) only handles {{ticker}}, so
> {{service=marketdata&method=currencies}} does nothing and leaves the body
> unchanged, with no error. Checked on 4.24.0-SNAPSHOT with the fake
> {{Exchange}}.
> Proposed: fail at endpoint creation when the method does not belong to the
> service.
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)