DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=34056>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=34056





------- Additional Comments From [EMAIL PROTECTED]  2005-03-17 21:18 -------
(From update of attachment 14506)
Index:
c:/projects3.0/commons-email/src/java/org/apache/commons/mail/MultiPartEmail.ja
va
===================================================================
---
c:/projects3.0/commons-email/src/java/org/apache/commons/mail/MultiPartEmail.ja
va   (revision 157757)
+++
c:/projects3.0/commons-email/src/java/org/apache/commons/mail/MultiPartEmail.ja
va   (working copy)
@@ -19,13 +19,16 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
+
 import javax.activation.DataHandler;
 import javax.activation.DataSource;
 import javax.activation.FileDataSource;
 import javax.activation.URLDataSource;
+import javax.mail.BodyPart;
 import javax.mail.MessagingException;
 import javax.mail.internet.MimeBodyPart;
 import javax.mail.internet.MimeMultipart;
+
 import org.apache.commons.lang.StringUtils;

 /**
@@ -52,7 +55,7 @@
     private MimeMultipart container = null;

     /** The message container. */
-    private MimeBodyPart primaryBodyPart = null;
+    private BodyPart primaryBodyPart = null;

     /** The MIME subtype. */
     private String subType = null;
@@ -92,7 +95,7 @@
     public Email addPart(String content, String contentType)
         throws EmailException
     {
-        MimeBodyPart bodyPart = new MimeBodyPart();
+        BodyPart bodyPart = createBodyPart();
         try
         {
             bodyPart.setContent(content, contentType);
@@ -115,7 +118,7 @@
      */
     public Email addPart(MimeMultipart multipart) throws EmailException
     {
-        MimeBodyPart bodyPart = new MimeBodyPart();
+        BodyPart bodyPart = createBodyPart();
         try {
             bodyPart.setContent(multipart);
             getContainer().addBodyPart(bodyPart);
@@ -140,7 +143,7 @@
             throw new IllegalStateException("Already initialized");
         }

-        container = new MimeMultipart();
+        container = createMimeMultipart();
         super.setContent(container);       

         initialized = true;
@@ -164,7 +167,9 @@
         try {
             if (StringUtils.isNotEmpty(charset))
             {
-                getPrimaryBodyPart().setText(msg, charset);
+//                BROKEN!
+//                getPrimaryBodyPart().setText(msg, charset);
+                getPrimaryBodyPart().setText(msg);
             }
             else
             {
@@ -192,7 +197,7 @@
                 // the content for the main body part was actually set.  If
not,
                 // an IOException will be thrown during super.send().

-                MimeBodyPart body = this.getPrimaryBodyPart();
+                BodyPart body = this.getPrimaryBodyPart();
                 Object content = null;
                 try
                 {
@@ -380,7 +385,7 @@
         {
             name = ds.getName();
         }
-        MimeBodyPart mbp = new MimeBodyPart();
+        BodyPart mbp = createBodyPart();
         try {
             getContainer().addBodyPart(mbp);

@@ -392,7 +397,7 @@
         catch (MessagingException me){
             throw new EmailException(me);
         }            
-        this.boolHasAttachments = true;
+        setBoolHasAttachments(true);

         return this;
     }
@@ -404,7 +409,7 @@
      * @throws EmailException see javax.mail.internet.MimeBodyPart
      *  for defintions
      */
-    protected MimeBodyPart getPrimaryBodyPart() throws MessagingException
+    protected BodyPart getPrimaryBodyPart() throws MessagingException
     {
         if (!initialized)
         {
@@ -414,7 +419,7 @@
         // Add the first body part to the message.  The fist body part must be
         if (this.primaryBodyPart == null)
         {
-            primaryBodyPart = new MimeBodyPart();
+            primaryBodyPart = createBodyPart();
             getContainer().addBodyPart(primaryBodyPart);
         }

@@ -437,6 +442,23 @@
         return container;
     }

+    /**
+     * 
+     * @return
+     */
+    protected boolean isInitialized()
+    {
+        return initialized;
+    }
+    
+    /**
+     * 
+     * @param b
+     */
+    protected void setIsInitialized(boolean b)
+    {
+        initialized = b;
+    }

     /**
      * @return boolHasAttachments
@@ -453,5 +475,24 @@
     {
         boolHasAttachments = b;
     }
+    
+    /**
+     * 
+     * @return
+     */
+    protected BodyPart createBodyPart()
+    {
+        BodyPart bp = new MimeBodyPart();
+        return bp;
+    }

+    /**
+     * 
+     * @return 
+     */
+    public MimeMultipart createMimeMultipart()
+    {
+        MimeMultipart mmp = new MimeMultipart();
+        return mmp;
+    }
 }


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to