[
https://issues.apache.org/jira/browse/CAMEL-27644?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen updated CAMEL-27644:
--------------------------------
Fix Version/s: 4.25.0
(was: 4.24.0)
> camel-geocoder: GeoApiContext not shut down, Nominatim region code and proxy,
> metadata
> --------------------------------------------------------------------------------------
>
> Key: CAMEL-27644
> URL: https://issues.apache.org/jira/browse/CAMEL-27644
> Project: Camel
> Issue Type: Bug
> Components: camel-geocoder
> Reporter: Claus Ibsen
> Priority: Minor
> Fix For: 4.25.0
>
>
> Found while improving the option descriptions of camel-geocoder for
> CAMEL-23832 (commit
> https://github.com/apache/camel/commit/7dc41981c854b9bada7624307e559d5232bf98ee).
> These are separate problems of the component; the descriptions commit only
> documents the current behavior.
> h4. 1. The Google producer never shuts down its GeoApiContext
> {{GeoCoderGoogleProducer.doStart()}} creates a {{GeoApiContext}} with
> {{GeoCoderEndpoint.createGeoApiContext()}}, and the producer has no
> {{doStop()}}. The OkHttp client and the rate limiter threads of the context
> stay alive after the route or the CamelContext stops, and each restart of the
> producer creates a new context.
> Add a {{doStop()}} that calls {{GeoApiContext.shutdown()}} on a context the
> endpoint created. Do not shut down a context that the {{geoApiContext}}
> component option provides.
> h4. 2. CamelGeoCoderRegionCode is always empty with Nominatim
> {{GeoCoderNominatimProducer.extractRegion()}} reads
> {{$['address']['state_code']}}. The Nominatim {{jsonv2}} answers have no
> {{state_code}}; they give the ISO 3166-2 code as {{ISO3166-2-lvl4}} (for
> example {{ES-AN}} in the test files {{search-calle-marie-curie.json}} and
> {{reverse-sevilla.json}}). The header is therefore set to null.
> Read {{ISO3166-2-lvl4}} (and keep {{state_code}} as a fallback), and decide
> whether the header holds the full code or the part after the country prefix.
> h4. 3. The proxy options are ignored with Nominatim
> The proxy options ({{proxyHost}}, {{proxyPort}}, {{proxyAuthMethod}}, ...)
> are applied only in {{GeoCoderEndpoint.createGeoApiContext()}}, which only
> the Google producer uses. {{GeoCoderNominatimProducer}} builds its client
> with {{HttpClients.custom()}} without a proxy and without
> {{useSystemProperties()}}, so a Nominatim endpoint behind a proxy cannot
> connect.
> Configure the proxy (and its credentials) on the HttpClient of the Nominatim
> producer as well.
> h4. 4. The address current leaves CamelGeoCoderLatlng set when the reverse
> lookup finds nothing
> {{GeoCoderGoogleProducer.processCurrentLocation()}} sets
> {{CamelGeoCoderStatus}} to OK and {{CamelGeoCoderLatlng}} to the geolocated
> location, then does the reverse lookup. When it has no result,
> {{extractGeoResult()}} sets the status to ZERO_RESULTS but the latitude and
> longitude header stays. For all other lookups the result headers are set only
> when the status is OK.
> Either set the header only after a successful reverse lookup, or document it
> as intended (the location is known even without an address).
> h4. 5. proxyAuthDomain and proxyAuthHost do nothing
> {{GeoCoderEndpoint}} has the options {{proxyAuthDomain}} and
> {{proxyAuthHost}} (meant for NTLM), but no code reads them, and
> {{AuthenticationMethod}} has only {{Basic}} and {{Digest}}:
> {{configureProxyAuth()}} fails for any other value.
> Deprecate both options (and remove them in a later release), or add NTLM
> support.
> h4. 6. The type option has no defaultValue in the metadata
> {{GeoCoderEndpoint.getType()}} and {{GeoCoderType.fromValue()}} use
> {{GOOGLE}} when {{type}} is not set, but the {{@UriParam}} of {{type}} has no
> {{defaultValue}}, so the catalog and the docs show no default.
> Add {{defaultValue = "GOOGLE"}}.
> h4. 7. CamelGeoCoderStatus is marked as required
> {{GeoCoderConstants.STATUS}} has {{required = true}}, but it is an output
> header that the producer sets; the user never provides it.
> Remove {{required = true}}.
> h4. 8. The URI syntax reads as two path parameters
> The syntax is {{geocoder:address:latlng}}, which reads as two path
> parameters. {{GeoCoderComponent.createEndpoint()}} takes either
> {{address:<address>}} or {{latlng:<latitude>,<longitude>}}.
> Change the syntax or the path metadata so that the docs show the two forms,
> for example as the URI format section of the doc page does.
> h4. 9. getServiceUrl() is always Google
> {{GeoCoderEndpoint.getServiceUrl()}} returns {{https://www.googleapis.com}}
> also when {{type}} is {{NOMINATIM}}, so the service location of a Nominatim
> endpoint is wrong.
> Return {{serverUrl}} for Nominatim.
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)