package io.openex.email.attachment;

import org.apache.camel.Exchange;
import org.apache.camel.impl.DefaultAttachment;

import javax.mail.util.ByteArrayDataSource;
import java.util.ArrayList;
import java.util.List;

import static io.openex.email.attachment.EmailDownloader.ATTACHMENTS_CONTENT;

/**
 * Created by Julien on 19/12/2016.
 */
@SuppressWarnings({"PackageAccessibility", "WeakerAccess"})
public class EmailAttacher {
	
	@SuppressWarnings({"unused", "unchecked"})
	public void process(Exchange exchange) {
		List<EmailAttachment> filesContent = (List) exchange.getProperty(ATTACHMENTS_CONTENT, new ArrayList<>());exchange.setProperty(Exchange.CHARSET_NAME, "UTF-8");
		
		for (EmailAttachment attachment : filesContent) {
			ByteArrayDataSource bds = new ByteArrayDataSource(attachment.getData(), attachment.getContentType());
			exchange.getIn().addAttachmentObject(attachment.getName(), new DefaultAttachment(bds));
		}
	}
}

@@ -620,64 +620,8 @@
 ());
-exchange.setProperty(Exchange.CHARSET_NAME, %22UTF-8%22);%0A%09%09
 %0A%09%09f

Remove extra line already handle by the route xml