Claus Ibsen created CAMEL-26170:
-----------------------------------
Summary: camel-geocoder - Nominatim with no results fails with
IllegalArgumentException instead of ZERO_RESULTS
Key: CAMEL-26170
URL: https://issues.apache.org/jira/browse/CAMEL-26170
Project: Camel
Issue Type: Bug
Components: camel-geocoder
Reporter: Claus Ibsen
Fix For: 4.24.0
Found while adding the catalog body types of geocoder (CAMEL-24961, PR #28412).
h4. 1. Nominatim with no results fails with IllegalArgumentException after
setting the status OK
{{GeoCoderNominatimProducer.extractResult}} (main 2a465aa4814c, line 127) sets
the {{CamelGeoCoderStatus}} header to {{OK}} (line 136) for any non-empty
answer. When Nominatim finds nothing it answers {{[]}}; the brackets are cut
off (line 138), and {{JsonPath.parse("")}} (line 144) throws
{{IllegalArgumentException: json string can not be null or empty}}, so the
exchange fails instead of answering {{ZERO_RESULTS}}. Checked on
4.24.0-SNAPSHOT with a local HTTP server as the Nominatim {{serverUrl}}.
Proposed: treat an empty array (or an empty string after removing the brackets)
as {{ZERO_RESULTS}}, as for an empty answer.
h4. 2. Two unit tests call the real nominatim.openstreetmap.org
{{GeoCoderNominatimTest}} (line 44) and {{GeoCoderNominatimAddressTest}} (line
44) use {{serverUrl=RAW(https://nominatim.openstreetmap.org)}}, so the build
depends on the public service (network, rate limits, changing data). Read in
the code, not run.
Proposed: point the tests at a local HTTP server with a recorded answer, or
move them to a manual IT.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)