]
Tomaz Cerar reassigned WFLY-778:
--------------------------------
Assignee: (was: Tomaz Cerar)
Only one deployed application can use custom mailcap
----------------------------------------------------
Key: WFLY-778
URL:
https://issues.jboss.org/browse/WFLY-778
Project: WildFly
Issue Type: Bug
Components: EE, Mail
Environment: AS 7, many applications deployed with custom mailcaps.
Reporter: Philippe Guinot
Priority: Minor
Labels: activation, javax, mail, mailcap, mailcapcommandmap
In the MailcapCommandMap class, it loads the mailcap file only once. This may cause
troubles when different applications use different custom mailcap.
Also, if no mailcap is found in the current class loader, only ONE mailcap file from the
module will be loaded, and not all of them, which is an issue if we get the mail-dsn jar
added in the javax.mail.api module.
If there is only one application deployed, adding in the jboss-deployement-structure.xml
the following dependency:
{code:xml}<module name="javax.mail.api"><imports><include
path="META-INF"/><include
path="META-INF/**"/></imports></module>{code}
and, from the application, calling at startup:
{code}javax.activation.CommandMap.setDefaultCommandMap(new MailcapCommandMap());{code}
cause the loading of all mailcap files found from the current class loader (those of the
application + those of javax.mail.api module).
But, if there are more than one application deployed, only the first to do so will have
its mailcap loaded.
The design of javax.activation should be changed to take in account this side-effect of
isolation: what happen if 2 applications define different classes for the same type/mime
??