Bug 12364 - AttachTag bug
Summary: AttachTag bug
Alias: None
Product: Taglibs
Classification: Unclassified
Component: Mailer Taglib (show other bugs)
Version: 1.0
Hardware: PC All
: P3 blocker (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2002-09-06 14:20 UTC by Sasha
Modified: 2005-03-20 17:06 UTC (History)
0 users

Java Source file of AttachTag class (9.47 KB, text/plain)
2002-09-06 14:27 UTC, Sasha

Note You need to log in before you can comment on or make changes to this bug.
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