allthingssecurity opened a new pull request, #30998:
URL: https://github.com/apache/camel/pull/30998

   # Description
   
   [CAMEL-27609](https://issues.apache.org/jira/browse/CAMEL-27609)
   
   The ticket lists two problems of camel-ldif that came up while the option 
descriptions were written for CAMEL-23832 (#30932). I checked both against main 
and fixed both.
   
   Fixed:
   1. **With allowUrlBody=true, a body that is not an absolute URL failed with 
a raw IllegalArgumentException.** The producer parses such a body with 
`URI.create(body).toURL()` and caught only `MalformedURLException`, which 
`toURL()` throws for an unknown scheme. A body with a space or another illegal 
URI character (`URI.create()`) and a relative text such as `foo` (`toURL()`, 
"URI is not absolute") throw `IllegalArgumentException`, which was not caught. 
Both now fail with an `InvalidPayloadException`, as the unknown scheme already 
did, with the parse error as its cause. The catch is around the URL parsing 
only. Fetching the URL and applying the LDIF are outside it, so a URL that 
cannot be fetched keeps its own exception, as before (the old catch also 
covered the fetch, but `openStream()` does not throw `MalformedURLException`).
   2. **The doc page used an old path name and the Out body wording.** The "URI 
format" section now shows `ldif:ldapConnectionName` and says that it is the 
name of an `LdapConnection` bean in the registry, and the "Result" section says 
that the producer sets the `List<String>` as the message body. The "Body types" 
section also says that a body that is not a valid absolute URL fails with an 
`InvalidPayloadException`. The catalog copy of the page is updated too.
   
   The changed exception type is in the 4.24 upgrade guide.
   
   #30932 touches the same doc page (only its `:description:` line) and the 
catalog copy, so whichever is merged second may need a small rebase. No 
description text in #30932 becomes wrong: its `allowUrlBody` description says 
that with `false` such a body fails with an `IllegalArgumentException`, which 
does not change.
   
   Tests (new, no LDAP server needed, as the failure comes before the 
connection is used):
   - `LdifUrlBodyParseTest` with `allowUrlBody=true`: a body with spaces and 
the relative body `foo` fail with an `InvalidPayloadException` that has an 
`IllegalArgumentException` as cause; a URL with an unknown scheme fails with an 
`InvalidPayloadException` (as on main); a `file:` URL that does not exist fails 
with its `FileNotFoundException` (as on main). Against the main sources the 
first two fail (`IllegalArgumentException` instead of 
`InvalidPayloadException`); the other two pass, as they check behaviour that 
does not change.
   
   Results (offline, module build of camel-ldif, test phase): 14 tests run, 0 
failures, 0 errors, 0 skipped. The new test class passes 5 runs in a row. 
(`camel-test-infra-openldap` was built in the same reactor, as it was not 
available locally.)
   
   Generated files: none besides the catalog copy of the doc page; the 
component JSON does not change.
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   # Tracking
   - [x] If this is a large change, bug fix, or code improvement, I checked 
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for 
the change (usually before you start working on it): 
[CAMEL-27609](https://issues.apache.org/jira/browse/CAMEL-27609).
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   - [ ] I have run `mvn clean install -DskipTests` locally from root folder 
and I have committed all auto-generated changes.
     (I built camel-ldif and ran its unit tests. The catalog copy of the doc 
page was updated by hand to match it, as an offline build of the catalog was 
not possible here. I did not run the full root build.)
   
   # AI-assisted contributions
   
   - [x] If this PR includes AI-generated code, commits have proper 
co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR 
description identifies the AI tool used.
     This PR was prepared with Claude Code (Claude Opus 5.5). The commit 
carries a `Co-Authored-By` trailer.
   
   _Claude Code on behalf of allthingssecurity_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to