noel 2003/03/10 23:19:56
Modified: src/java/org/apache/james/core Tag: branch_2_1_fcs
MimeMessageWrapper.java
Log:
If we get a MessagingException, e.g., ParseException, from
MimeMessage.getInputStream(), try getRawInputStream() as a fall-back
Revision Changes Path
No revision
No revision
1.17.4.8 +19 -2
jakarta-james/src/java/org/apache/james/core/MimeMessageWrapper.java
Index: MimeMessageWrapper.java
===================================================================
RCS file:
/home/cvs/jakarta-james/src/java/org/apache/james/core/MimeMessageWrapper.java,v
retrieving revision 1.17.4.7
retrieving revision 1.17.4.8
diff -u -r1.17.4.7 -r1.17.4.8
--- MimeMessageWrapper.java 10 Mar 2003 20:40:17 -0000 1.17.4.7
+++ MimeMessageWrapper.java 11 Mar 2003 07:19:55 -0000 1.17.4.8
@@ -364,7 +364,6 @@
bos = MimeUtility.encode(bodyOs, message.getEncoding());
bis = message.getInputStream();
} catch(javax.activation.UnsupportedDataTypeException udte) {
-
/* If we get an UnsupportedDataTypeException try using
* the raw input stream as a "best attempt" at rendering
* a message.
@@ -388,8 +387,26 @@
try {
bis = message.getRawInputStream();
bos = bodyOs;
- } catch(javax.mail.MessagingException me) {
+ } catch(javax.mail.MessagingException _) {
throw udte;
+ }
+ }
+ catch(javax.mail.MessagingException me) {
+ /* This could be another kind of MessagingException
+ * thrown by MimeMessage.getInputStream(), such as a
+ * javax.mail.internet.ParseException.
+ *
+ * The ParseException is precisely one of the reasons
+ * why the getRawInputStream() method exists, so that we
+ * can continue to stream the content, even if we cannot
+ * handle it. Again, if we get an exception, we throw
+ * the one that caused us to call getRawInputStream().
+ */
+ try {
+ bis = message.getRawInputStream();
+ bos = bodyOs;
+ } catch(javax.mail.MessagingException _) {
+ throw me;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]