davsclaus opened a new pull request, #30738: URL: https://github.com/apache/camel/pull/30738
_Claude Code on behalf of davsclaus_ JIRA: https://issues.apache.org/jira/browse/CAMEL-27526 ## Problem Camel has no type converter from `String` to `OffsetDateTime`, `ZonedDateTime` or `Instant`. An endpoint option of one of these types cannot be set in a URI or as a property. Startup fails with `No type converter available to convert from type: java.lang.String to the required type: java.time.OffsetDateTime`. Only a bean reference (`#bean`) works. Options affected on main: | Component | Option | Type | |---|---|---| | azure-servicebus | scheduledEnqueueTime | OffsetDateTime | | azure-storage-blob | changeFeedStartTime, changeFeedEndTime | OffsetDateTime | | minio | modifiedSince, unModifiedSince | ZonedDateTime | | aws2-cw | timestamp | Instant | | dapr | workflowStartTime | Instant | ## Changes - `DateTimeConverter` (camel-base): new converters from `String` to `OffsetDateTime`, `ZonedDateTime` and `Instant`. ISO-8601 only (`X.parse`), trimmed. An empty or blank string converts to `null` (`allowNull = true`). - A space is read as `+`. In an endpoint URI the `+` of a positive offset is decoded to a space, and ISO-8601 never contains a space. `%2B` and `RAW(...)` work too. The Javadoc says so. - Regenerated `CamelBaseBulkConverterLoader`. - Upgrade guide 4.24 (camel-core): these options can now be set in a URI, and `${headerAs(x, java.time.Instant)}` on an ISO-8601 string now converts instead of giving `null`. ## Tests - `DateTimeConverterTest`: offsets `+01:00`, `-05:00` and `Z`, the space-for-plus case, `[Europe/Paris]` for `ZonedDateTime`, `Instant`, empty -> `null`, invalid -> `TypeConversionException`. - New `JavaTimeEndpointOptionTest`: a test component with options of the three types set in an endpoint URI (plain `+`, `%2B`, `RAW(...)`, zone id), and `${headerAs(when, java.time.Instant)}` with a valid and an invalid value. - Ran in camel-core: `DateTimeConverterTest`, `JavaTimeEndpointOptionTest`, `DurationConverterTest`: 19 tests, all passed. Also the `converter`, `impl.converter`, `language.simple` packages and `PropertyBinding*Test`: 1197 tests, 0 failures, 1 skipped. ## Note #30730 (azure-servicebus: scheduledEnqueueTime in a URI) adds its own `String` -> `OffsetDateTime` converter in `ServiceBusTypeConverter`. It will drop that converter after this merges. 🤖 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]
