You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by "Guillaume Nodet (JIRA)" <ji...@apache.org> on 2009/03/17 16:32:50 UTC

[jira] Created: (GERONIMO-4591) Email attachments name can not be retrieved

Email attachments name can not be retrieved
-------------------------------------------

                 Key: GERONIMO-4591
                 URL: https://issues.apache.org/jira/browse/GERONIMO-4591
             Project: Geronimo
          Issue Type: Bug
      Security Level: public (Regular issues)
          Components: specs
            Reporter: Guillaume Nodet




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


[jira] Commented: (GERONIMO-4591) Email attachments name can not be retrieved

Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/GERONIMO-4591?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12682701#action_12682701 ] 

Guillaume Nodet commented on GERONIMO-4591:
-------------------------------------------

The following patch should work, but I'm waiting for a confirmation that it actually works before committing it.

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

> Email attachments name can not be retrieved
> -------------------------------------------
>
>                 Key: GERONIMO-4591
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-4591
>             Project: Geronimo
>          Issue Type: Bug
>      Security Level: public(Regular issues) 
>          Components: specs
>            Reporter: Guillaume Nodet
>


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


[jira] Resolved: (GERONIMO-4591) Email attachments name can not be retrieved

Posted by "Guillaume Nodet (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/GERONIMO-4591?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Guillaume Nodet resolved GERONIMO-4591.
---------------------------------------

    Resolution: Fixed
      Assignee: Guillaume Nodet

Sending        geronimo-javamail_1.4_spec/src/main/java/javax/mail/internet/MimeMessage.java
Sending        geronimo-javamail_1.4_spec/src/main/java/javax/mail/internet/MimePartDataSource.java
Sending        geronimo-javamail_1.4_spec/src/test/java/javax/mail/internet/MimeTest.java
Transmitting file data ...
Committed revision 756013.


> Email attachments name can not be retrieved
> -------------------------------------------
>
>                 Key: GERONIMO-4591
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-4591
>             Project: Geronimo
>          Issue Type: Bug
>      Security Level: public(Regular issues) 
>          Components: specs
>            Reporter: Guillaume Nodet
>            Assignee: Guillaume Nodet
>


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