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

   ## Problem
   
   `Ses2Producer.createMessage()` builds the outgoing `Content` from
   `exchange.getIn().getBody(String.class)`. When the body is an SES
   `RawMessage`, there is no type converter for it, so the conversion falls back
   to `Object.toString()` on the SDK type.
   
   `SdkBytes.toString()` renders a *debug descriptor*, not the payload:
   
   ```
   SdkBytes(bytes=0x46726f6d3a2066726f6d406578616d706c652e636f6d0d0a...)
   ```
   
   That descriptor is what ends up in the e-mail body — the actual MIME content
   is never sent.
   
   ## Fix
   
   When the body is a `RawMessage`, read the payload from
   `RawMessage.data().asUtf8String()`:
   
   ```java
   if (exchange.getIn().getBody() instanceof RawMessage raw) {
       // SdkBytes.toString() is a debug descriptor (SdkBytes(bytes=0x...)), 
not the payload
       content = raw.data().asUtf8String();
   } else {
       content = exchange.getIn().getBody(String.class);
   }
   ```
   
   Note this path is distinct from the `jakarta.mail.Message` body, which 
already
   goes through `sendRawEmail` and is unaffected.
   
   ## Test
   
   `SesComponentTest.rawMessageBodyIsSentAsItsContentNotTheSdkBytesDescriptor()`
   sends a `RawMessage` and asserts the text captured by the mock SES client
   equals the original MIME string. The test fails on `main` with the
   `SdkBytes(bytes=0x...)` descriptor and passes with the fix.
   
   `assertj-core` is added test-scoped so the new assertion follows the 
project's
   AssertJ preference; the pre-existing JUnit assertions in the file are left
   untouched.
   
   ## Backport
   
   The same code is present on `camel-4.18.x` and `camel-4.14.x`, so this is
   targeted at 4.22.0, 4.18.4 and 4.14.9.
   
   ---
   _Claude Code on behalf of oscerd_


-- 
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