Bug 12364

Summary: AttachTag bug
Product: Taglibs Reporter: Sasha <dj_sasha>
Component: Mailer TaglibAssignee: Tomcat Developers Mailing List <dev>
Status: CLOSED FIXED    
Severity: blocker    
Priority: P3    
Version: 1.0   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: Java Source file of AttachTag class

Description Sasha 2002-09-06 14:20:04 UTC
When you want to attach multiple files to a mail, the number of attachments 
(size of the bodyparts collection) is respected but only the last filename of 
the collection is always attached.

So if you have 5 attachments, you will have 5 times the last filename attached.

This is the cause of the problem in the AttachTag class:

MimeBodyPart mbp = new MimeBodyPart();

must be changed in:

MimeBodyPart mbp = null;

and in the doAfterBody() method you must make a new isntance of this object at 
each time the function is called, namely:

mbp = new MimeBodyPart();

Otherwise if this isn't done that way, the different items of the bodyparts 
collection will always point at one point of the memory where a MimeBodyPart is 
stored (basic Java knowledge, like pointers in C++)
Comment 1 Sasha 2002-09-06 14:27:15 UTC
Created attachment 2953 [details]
Java Source file of AttachTag class