davsclaus opened a new pull request, #28358: URL: https://github.com/apache/camel/pull/28358
Fixes the bugs in 9 messaging components found while adding the catalog body types (CAMEL-24961). Several producers sent a body they cannot handle as empty or wrong data, or did nothing without an error, and several replies lost their body or went to the wrong place. The changes per JIRA: | JIRA | Component | Fix | |---|---|---| | [CAMEL-26013](https://issues.apache.org/jira/browse/CAMEL-26013) | mail | The converters from a multipart mail allow null. Before, a mail with no text part fell back to `MimeMultipart@...`, and the registry cached that for every later mail. A text part without a content handler, such as `text/csv`, is read as text in its charset. A `text/*` contentType without a charset declares the charset the text is encoded in. A producer on imap/imaps/pop3/pop3s fails when it is created. A store message (`mapMailMessage=false`) is sent as a copy, since it is read-only. A body set to null on a consumer message stays null. | | [CAMEL-26014](https://issues.apache.org/jira/browse/CAMEL-26014) | smpp | The body is read once, so a stream is no longer sent empty. No body fails with an `InvalidPayloadException` (wrapped in `SmppException`), not an NPE. The 8-bit `dataCoding`/`alphabet` options send a `byte[]` as it is, as the headers do. After InOut the message keeps its body and headers. An unknown `CamelSmppCommand` fails; a missing header still means SubmitSm. | | [CAMEL-26015](https://issues.apache.org/jira/browse/CAMEL-26015) | spring-rabbitmq | A consumer reply that leaves the content type header as the request set it is handled by body type. A String keeps the content type. A `byte[]` or stream keeps it unless it is `text/*`, in which case it is sent as `application/octet-stream`. Other bodies get the content type the converter derives. A Spring AMQP `Message` reply gets the request's correlation id when it has none. | | [CAMEL-26016](https://issues.apache.org/jira/browse/CAMEL-26016) | nats | An InOut reply with no body is an empty message. A body that does not convert to `byte[]` goes to the consumer exception handler instead of being dropped silently. JetStream messages are never answered, since their reply subject is the ack subject, and a WARN is logged at startup. | | [CAMEL-26017](https://issues.apache.org/jira/browse/CAMEL-26017) | paho, paho-mqtt5 | The body is read with `getMandatoryBody(byte[].class)`, so a body that does not convert fails with an `InvalidPayloadException` instead of an NPE with no message. | | [CAMEL-26021](https://issues.apache.org/jira/browse/CAMEL-26021) | solr | The catalog says `deleteByQuery` defaults to false, as the code does. The converter to Map no longer turns any value into an empty Map. Without a body, SEARCH and DELETE fail unless a header or the request parameters give what they need; before, they used `java.lang.Object@...`. An INSERT of a body that is not a document fails also when the request has parameters. XML with a declaration is wrapped correctly, and null field values no longer NPE. The docs examples name a collection. | | [CAMEL-26022](https://issues.apache.org/jira/browse/CAMEL-26022) | ssh | The shell channel without `shellPrompt` fails at start. `sleepForShellPrompt` really defaults to 100. `SshResult.STDERR` is `CamelSshStderr` again. The docs say the `timeout` option does not cover the command run. | | [CAMEL-26023](https://issues.apache.org/jira/browse/CAMEL-26023) | slack | Webhook mode writes snake_case JSON with the Slack SDK Gson, so Slack applies the icons, thread_ts, attachments and so on. The send no longer changes the body. Token mode sends the attachments of a `SlackMessage`. A RuntimeException fails the exchange once. The CloudEvents transformer sets the right source and subject. | | [CAMEL-26024](https://issues.apache.org/jira/browse/CAMEL-26024) | telegram | A `byte[]` with media type TEXT is a text message. Streams and files are sent as media. An `IncomingMessage` without text is skipped. An `ok=false` answer fails the exchange. The request buffer grows to its content, so media over 1 MB work; `bufferSize` is now the initial size, with a default of 8 KB. Number parts are sent, and text parts are UTF-8. | [CAMEL-26018](https://issues.apache.org/jira/browse/CAMEL-26018) (mail) is in #28308. Redis and couchbase ([CAMEL-26019](https://issues.apache.org/jira/browse/CAMEL-26019), [CAMEL-26020](https://issues.apache.org/jira/browse/CAMEL-26020)) are in a separate PR. This PR removes only the `new Object()` lines from `SolrProducer`, so the overlap with #28312 is small. ## Upgrade guide 4.24 gets one section per component that covers the behaviour changes above. ## Tests Every module has new unit tests, and each of them failed before its fix. All module suites pass: | Module | Tests | |---|---| | mail | 266 | | smpp | 171 | | paho | 75 | | paho-mqtt5 | 73 | | spring-rabbitmq | 16 | | nats | 9 | | solr | 56 (including its integration tests) | | ssh | 78 | | slack | 1026 | | telegram | 122 | _Claude Code on behalf of davsclaus_ 🤖 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]
