Claus Ibsen created CAMEL-27609:
-----------------------------------

             Summary: camel-ldif: non-URL body with allowUrlBody gives a raw 
IllegalArgumentException; doc path name
                 Key: CAMEL-27609
                 URL: https://issues.apache.org/jira/browse/CAMEL-27609
             Project: Camel
          Issue Type: Bug
          Components: camel-ldap
            Reporter: Claus Ibsen
             Fix For: 4.24.0


Found while improving the option descriptions of camel-ldif for CAMEL-23832 (PR 
https://github.com/apache/camel/pull/30932).
These are separate problems of the component; the descriptions PR only 
documents the current behavior.

h4. 1. With allowUrlBody=true, a body that is not an absolute URL fails with 
IllegalArgumentException, not InvalidPayloadException
{{LdifProducer.process()}} reads a body that does not start with {{version: 1}} 
as a URL with {{URI.create(body).toURL()}}, and catches only 
{{MalformedURLException}} to throw an {{InvalidPayloadException}}.
A body with a space or another illegal URI character makes {{URI.create()}} 
throw an {{IllegalArgumentException}}, and a relative text such as {{foo}} 
makes {{toURL()}} throw an {{IllegalArgumentException}} ("URI is not 
absolute"). Neither is caught, so the user gets a raw 
{{IllegalArgumentException}}, and only a body with an unknown URL scheme gets 
the intended {{InvalidPayloadException}}.
Proposed change: also catch {{IllegalArgumentException}} around the URL parsing 
(not around the fetch) and throw the {{InvalidPayloadException}} in both cases.

h4. 2. The doc page uses an old path name and the Out body wording
{{src/main/docs/ldif-component.adoc}} shows the URI as 
{{ldif:ldapServerBean[?options]}} and talks about the {{ldapServerBean}} 
portion, while the syntax of the endpoint is {{ldif:ldapConnectionName}}. The 
"Result" section says the result is returned in the "Out body", a term Camel no 
longer uses.
Proposed change: use {{ldif:ldapConnectionName}} in the "URI format" section, 
and say that the producer sets the {{List<String>}} as the message body.

_Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to