This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-4.22.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-4.22.x by this push:
new fcad10b090dd [backport camel-4.22.x] CAMEL-24597: Fix MailConverters
double getContent() causing flaky POP3 test (#26301)
fcad10b090dd is described below
commit fcad10b090dde230b396c27009e553875a8522ae
Author: Guillaume Nodet - AI Bot <[email protected]>
AuthorDate: Fri Sep 11 15:20:01 2026 +0200
[backport camel-4.22.x] CAMEL-24597: Fix MailConverters double getContent()
causing flaky POP3 test (#26301)
Backport of #26247 to camel-4.22.x.
Co-authored-by: Claude Sonnet 4.6 <[email protected]>
---
.../main/java/org/apache/camel/component/mail/MailConverters.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git
a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConverters.java
b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConverters.java
index 846c8f181685..9528494f2a8d 100644
---
a/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConverters.java
+++
b/components/camel-mail/src/main/java/org/apache/camel/component/mail/MailConverters.java
@@ -85,17 +85,17 @@ public final class MailConverters {
for (int i = 0; i < size; i++) {
BodyPart part = multipart.getBodyPart(i);
Object content = part.getContent();
- while (content instanceof MimeMultipart) {
- if (multipart.getCount() < 1) {
+ while (content instanceof MimeMultipart mimeMultipart) {
+ if (mimeMultipart.getCount() < 1) {
break;
}
- part = ((MimeMultipart) content).getBodyPart(0);
+ part = mimeMultipart.getBodyPart(0);
content = part.getContent();
}
// Perform a case-insensitive "startsWith" check that works
for different locales
String prefix = "text";
if (part.getContentType().regionMatches(true, 0, prefix, 0,
prefix.length())) {
- return part.getContent().toString();
+ return content.toString();
}
}
} catch (MessagingException e) {