[ 
https://issues.apache.org/activemq/browse/SMXCOMP-472?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=50602#action_50602
 ] 

Guillaume Nodet commented on SMXCOMP-472:
-----------------------------------------

The following patch should be applied on 
https://svn.apache.org/repos/asf/geronimo/specs/trunk/geronimo-javamail_1.4_spec.
You'll have to rebuild this spec and update our servicemix spec to this 
snapshot for testing.
Let me know the outcome and i'll commit this patch if it works.

{code}
Index: src/main/java/javax/mail/internet/MimePartDataSource.java
===================================================================
--- src/main/java/javax/mail/internet/MimePartDataSource.java   (revision 
755277)
+++ src/main/java/javax/mail/internet/MimePartDataSource.java   (working copy)
@@ -111,6 +111,13 @@
     }
 
     public String getName() {
+        try {
+            if (part instanceof MimeBodyPart) {
+                return ((MimeBodyPart) part).getFileName();
+            }
+        } catch (MessagingException mex) {
+            // ignore it
+        }
         return "";
     }
 
Index: src/main/java/javax/mail/internet/MimeBodyPart.java
===================================================================
--- src/main/java/javax/mail/internet/MimeBodyPart.java (revision 755277)
+++ src/main/java/javax/mail/internet/MimeBodyPart.java (working copy)
@@ -296,7 +296,7 @@
 
     public String getFileName() throws MessagingException {
         // see if there is a disposition.  If there is, parse off the filename 
parameter.
-        String disposition = getSingleHeader("Content-Disposition");
+        String disposition = getDisposition();
         String filename = null;
 
         if (disposition != null) {
@@ -306,7 +306,7 @@
         // if there's no filename on the disposition, there might be a name 
parameter on a
         // Content-Type header.
         if (filename == null) {
-            String type = getSingleHeader("Content-Type");
+            String type = getContentType();
             if (type != null) {
                 try {
                     filename = new ContentType(type).getParameter("name");
@@ -350,7 +350,7 @@
         contentDisposition.setParameter("filename", name);
 
         // serialize this back out and reset.
-        setHeader("Content-Disposition", contentDisposition.toString());
+        setDisposition(contentDisposition.toString());
 
         // The Sun implementation appears to update the Content-type name 
parameter too, based on
         // another system property
{code}

> ServiceMix-Mail broken in SMX4
> ------------------------------
>
>                 Key: SMXCOMP-472
>                 URL: https://issues.apache.org/activemq/browse/SMXCOMP-472
>             Project: ServiceMix Components
>          Issue Type: Bug
>          Components: servicemix-mail
>    Affects Versions: servicemix-mail-2009.01
>         Environment: Linux 2.6
> ServiceMix 4 (trunk)
>            Reporter: Lars Heinemann
>
> Somehow the mail component is broken in SMX4. Didn't checked yet for SMX3.
> When receiving a mail with attachment from a IMAP server I get the following 
> exception:
> {noformat}
> 15:51:16,712 | ERROR | ix-mail-thread-5 | MailComponent                    | 
> common.endpoints.PollingEndpoint  222 | Caught exception while polling: 
> org.apache.geronimo.javamail.util.ResponseFormatException: String token 
> expected in response: (
> org.apache.geronimo.javamail.util.ResponseFormatException: String token 
> expected in response: (
>       at 
> org.apache.geronimo.javamail.store.imap.connection.IMAPResponseTokenizer.readString(IMAPResponseTokenizer.java:620)
>       at 
> org.apache.geronimo.javamail.store.imap.connection.IMAPBodyStructure.parseMessageExtensions(IMAPBodyStructure.java:171)
>       at 
> org.apache.geronimo.javamail.store.imap.connection.IMAPBodyStructure.parseSinglepartBodyStructure(IMAPBodyStructure.java:153)
>       at 
> org.apache.geronimo.javamail.store.imap.connection.IMAPBodyStructure.parseBodyStructure(IMAPBodyStructure.java:76)
>       at 
> org.apache.geronimo.javamail.store.imap.connection.IMAPBodyStructure.<init>(IMAPBodyStructure.java:62)
>       at 
> org.apache.geronimo.javamail.store.imap.connection.IMAPBodyStructure.parseMultipartBodyStructure(IMAPBodyStructure.java:87)
>       at 
> org.apache.geronimo.javamail.store.imap.connection.IMAPBodyStructure.parseBodyStructure(IMAPBodyStructure.java:73)
>       at 
> org.apache.geronimo.javamail.store.imap.connection.IMAPBodyStructure.<init>(IMAPBodyStructure.java:62)
>       at 
> org.apache.geronimo.javamail.store.imap.connection.IMAPFetchResponse.<init>(IMAPFetchResponse.java:54)
>       at 
> org.apache.geronimo.javamail.store.imap.connection.IMAPResponseStream.readResponse(IMAPResponseStream.java:124)
>       at 
> org.apache.geronimo.javamail.store.imap.connection.IMAPConnection.receiveResponse(IMAPConnection.java:396)
>       at 
> org.apache.geronimo.javamail.store.imap.connection.IMAPConnection.sendCommand(IMAPConnection.java:324)
>       at 
> org.apache.geronimo.javamail.store.imap.connection.IMAPConnection.fetchBodyStructure(IMAPConnection.java:917)
>       at 
> org.apache.geronimo.javamail.store.imap.IMAPMessage.loadBodyStructure(IMAPMessage.java:943)
>       at 
> org.apache.geronimo.javamail.store.imap.IMAPMessage.getDataHandler(IMAPMessage.java:756)
>       at javax.mail.internet.MimeMessage.getContent(MimeMessage.java:927)
>       at 
> org.apache.servicemix.mail.marshaler.DefaultMailMarshaler.copyBodyAndAttachments(DefaultMailMarshaler.java:464)
>       at 
> org.apache.servicemix.mail.marshaler.DefaultMailMarshaler.convertMailToJBI(DefaultMailMarshaler.java:75)
>       at 
> org.apache.servicemix.mail.MailPollerEndpoint.poll(MailPollerEndpoint.java:254)
>       at 
> org.apache.servicemix.common.endpoints.PollingEndpoint$PollSchedulerTask$1.run(PollingEndpoint.java:202)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>       at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>       at java.lang.Thread.run(Thread.java:595)
> {noformat}
> If I receive a text/plain email without attachments I get the following 
> warning and the body property in NMSG is empty afterwards:
> {noformat}
> 15:52:16,645 | WARN  | ix-mail-thread-7 | DefaultMailMarshaler             | 
> l.marshaler.DefaultMailMarshaler  537 | The content of the mail message is 
> not supported by this component. (java.io.ByteArrayInputStream)
> {noformat}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to