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]
# 1
The message is most likely malformed (probably a virus mail or spam). Does this also happen when you call "getContents" on the parts of the message?
travis_fergusona at 2007-7-14 21:43:59 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2
What version of JavaMail are you using? If you're using a recent version,send a copy of the message causing the problem to javamail@sun.comand we'll help you figure it out.
bshannona at 2007-7-14 21:43:59 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3
I a m using Java Mail 1.3.. I have mailed the entire problem as you have suggested. Thanks a lot for your help
darchanaa at 2007-7-14 21:43:59 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 4
JavaMail 1.3 doesn't have the mail.mime.base64.ignoreerrors property.We'll deal with the rest offline.
bshannona at 2007-7-14 21:43:59 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 5
Hi I get this error whenever i read from a MS Word Document. Do I need to refer to the the HWPF project for this?
darchanaa at 2007-7-14 21:43:59 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 6

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)

burridgea at 2007-7-14 21:43:59 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 7

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.

bshannona at 2007-7-14 21:43:59 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 8

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.

burridgea at 2007-7-14 21:43:59 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...