Idea Harness created JAMES-1431:
-----------------------------------
Summary: Geronimo JavaMail implementation throws exception when
opening content of an image attachment
Key: JAMES-1431
URL: https://issues.apache.org/jira/browse/JAMES-1431
Project: JAMES Server
Issue Type: Bug
Components: Deployment Modules
Affects Versions: 3.0-beta4
Environment: Linux Fedora 14
Reporter: Idea Harness
When image files (Content-Type: image/gif, image/jpeg, image/jpg) are attached
to emails and
Apache James 3.0 Beta4 serves as an MTA I am getting these exceptions on
MimeBodyPart.getContent() calls below (while processing the mail within the
attached
test.mailet.BodyPartExtractingMailet mailet). This is due to the fact that as
of Apache James Beta4
it ships with Geronimo JavaMail implementation
(geronimo-javamail_1.4_mail-1.6.jar) that is the cause
of this exception (with Apache James Beta3 Oracle JavaMail implementation
(mail-1.4.4.jar) handled
this correctly without exceptions).
Precise steps to reproduce :
1. Deploy the attached test.mailet.BodyPartExtractingMailet to run within
Apache James Beta4
a. package it as a jar and put it under JAMES/lib
b. add <mailet match="All" class="test.mailet.BodyPartExtractingMailet"/> to
JAMES/conf/mailetcontainer.conf
c. add log4j.logger.test.mailet.BodyPartExtractingMailet=DEBUG, CONS, FILE to
JAMES/conf/log4j.properties
d. (re-) start James, tailing -f either JAMES/log/mailetcontainer.log or
JAMES/bin/wrapper.log
2. Using your favorite email client send an email to yourself (with Apache
James processing
your email) containing attachments with MimeTypes image/jpeg, image/jpg and
image/gif
(surprisingly enough image/png is handled without an exception). You can use
attached
btnbg_over.jpg and up_15x15.gif.
3. Observe these exceptions in the log file
spooler-1 | INFO | 11:51:14,807 08/13/2012 | mailetcontext | service() start
spooler-1 | INFO | 11:51:14,866 08/13/2012 | mailetcontext | BodyPart with an
image MimeType [image/gif;
name="up_15x15.gif"] found, BEFORE calling getContent() on it.
spooler-1 | INFO | 11:51:14,940 08/13/2012 | mailetcontext | Exception is
thrown during MimeBodyPart.getContent() call
javax.activation.UnsupportedDataTypeException: Unknown image type image/gif;
name="up_15x15.gif"
at
org.apache.geronimo.javamail.handlers.AbstractImageHandler.getContent(AbstractImageHandler.java:57)
at
javax.activation.DataSourceDataContentHandler.getContent(DataHandler.java:790)
at javax.activation.DataHandler.getContent(DataHandler.java:537)
at javax.mail.internet.MimeBodyPart.getContent(MimeBodyPart.java:637)
at
test.mailet.BodyPartExtractingMailet.service(BodyPartExtractingMailet.java:51)
at
org.apache.james.mailetcontainer.impl.camel.CamelProcessor.process(CamelProcessor.java:65)
...
spooler-1 | INFO | 11:51:14,945 08/13/2012 | mailetcontext | BodyPart with an
image MimeType [image/png;
name="arrow_down_8x8.png"] found, BEFORE calling getContent() on it.
spooler-1 | INFO | 11:51:14,961 08/13/2012 | mailetcontext | BodyPart with an
image MimeType found, AFTER calling getContent() on it.
spooler-1 | INFO | 11:51:14,961 08/13/2012 | mailetcontext | BodyPart with an
image MimeType [image/jpeg;
name="btnbg_over.jpg"] found, BEFORE calling getContent() on it.
spooler-1 | INFO | 11:51:14,962 08/13/2012 | mailetcontext | Exception is
thrown during MimeBodyPart.getContent() call
javax.activation.UnsupportedDataTypeException: Unknown image type image/jpeg;
name="btnbg_over.jpg"
at
org.apache.geronimo.javamail.handlers.AbstractImageHandler.getContent(AbstractImageHandler.java:57)
at
javax.activation.DataSourceDataContentHandler.getContent(DataHandler.java:790)
at javax.activation.DataHandler.getContent(DataHandler.java:537)
at javax.mail.internet.MimeBodyPart.getContent(MimeBodyPart.java:637)
at
test.mailet.BodyPartExtractingMailet.service(BodyPartExtractingMailet.java:51)
at
org.apache.james.mailetcontainer.impl.camel.CamelProcessor.process(CamelProcessor.java:65)
...
spooler-1 | INFO | 11:51:14,968 08/13/2012 | mailetcontext | service() end
Note #1: removing geronimo-javamail_1.4_mail-1.6.jar from the classpath fixes
the problem (ie, no
exceptions are thrown). However, you can't just comment the line out
wrapper.java.classpath.88=%REPO_DIR%/geronimo-javamail_1.4_mail-1.6.jar
in JAMES/conf/wrapper.conf as all jars after this line will be lost (as they
are expected to be in order); hence just set the JavaMail (mail-1.4.4.jar)
which was already set up earlier (as Classpath argument 10) ... as also jar
argument 88
wrapper.java.classpath.88=%REPO_DIR%/mail-1.4.4.jar
).
Note #2: This issue might be documented in
https://issues.apache.org/jira/browse/GERONIMO-5415
and was supposedly fixed in geronimo-javamail_1.4_mail-1.8.1.jar (however
Apache James Beta4 is using an older geronimo-javamail_1.4_mail-1.6.jar). I
don't know whether Apache James really needs
geronimo-javamail implementation as Oracle's JavaMail (ie. mail-1.4.4.jar)
seems to handle this
correctly.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]