java.io.IOException: Error in encoded stream
Hi
whenever i try to write the mime message to a document, i keep getting this exception
java.io.IOException: Error in encoded stream, got 3
at com.sun.mail.util.BASE64DecoderStream.decode(BASE64DecoderStream.java:148)
at com.sun.mail.util.BASE64DecoderStream.read(BASE64DecoderStream.java:53)
at com.sun.mail.util.BASE64DecoderStream.read(BASE64DecoderStream.java:78)
at java.io.FilterInputStream.read(FilterInputStream.java:110)
at javax.activation.DataHandler.writeTo(DataHandler.java:289)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1147)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:668)
at javax.mail.internet.MimeMultipart.writeTo(MimeMultipart.java:232)
at com.sun.mail.handlers.multipart_mixed.writeTo(multipart_mixed.java:67)
at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:839)
at javax.activation.DataHandler.writeTo(DataHandler.java:295)
I have even tried setting
System.setProperty("mail.mime.base64.ignoreerrors", "true");
Even this doesnot solve the problem..
Any ideas how to bypass this?
[1173 byte] By [
darchanaa] at [2007-10-3 3:47:06]

I too am seeing a slight variation of this error with JM 1.3.1. Unfortunately, the message has since been deleted. Any ideas?
java.io.IOException: Error in encoded stream, got 2
at com.sun.mail.util.BASE64DecoderStream.decode(BASE64DecoderStream.java:148)
at com.sun.mail.util.BASE64DecoderStream.read(BASE64DecoderStream.java:53)
at com.sun.mail.util.BASE64DecoderStream.read(BASE64DecoderStream.java:78)
at java.io.FilterInputStream.read(FilterInputStream.java:90)
at javax.activation.DataHandler.writeTo(DataHandler.java:289)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1147)
at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:668)
at javax.mail.internet.MimeMultipart.writeTo(MimeMultipart.java:233)
at com.sun.mail.handlers.multipart_mixed.writeTo(multipart_mixed.java:67)
at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:839)
at javax.activation.DataHandler.writeTo(DataHandler.java:295)
Without the message? No.
Upgrade to JavaMail 1.4 if you can. That will allow you to ignore the
error. But let's be clear... the source of the problem is that the program
that created the message encoded it incorrectly. If you can find out what
program created the message, report the problem there.
Appears to be the result of an Exchange 2000 bug. The bodystructure returned by Exchange reports "text/html" and "base64" while the content type and encoding in the headers are "text/plain" and "7bit". I was attempting a conversion based on the bodystructure. If I can report a bug to Microsoft I'll report it here. See the following commands I executed after telneting to Exchange IMAP:
3 UID FETCH 231027 (BODYSTRUCTURE)
* 972 FETCH (BODYSTRUCTURE ("TEXT" "HTML" ("charset" "utf-8") NIL NIL "BASE64" 2386 40 NIL NIL NIL) UID 231027)
3 OK FETCH completed.
4 UID FETCH 231027 (BODY.PEEK[HEADER])
* 972 FETCH (BODY[HEADER] {1149}
Date: Wed, 8 Nov 2006 21:59:47 -0800
From: user1@test.com
Subject: Test msg
To: user2@test.com, user3@test.com
Cc: user4@test.com, user5@test.com
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
UID 231027)
4 OK FETCH completed.