javax.mail.internet.ParseException: Expected ';', got ":"
Hello Everyone,
I get 2 exceptions when I use the MimeMultipart's getCount method on e-mail messages that have either a colon or equals characters.
javax.mail.internet.ParseException: Expected';', got":"
at javax.mail.internet.ParameterList.<init>(ParameterList.java:179)
at javax.mail.internet.ContentType.<init>(ContentType.java:100)
at javax.mail.internet.MimeMultipart.parsebm(MimeMultipart.java:651)
In the above case the Content-Types of the MimeMultipart BodyParts contain colon(s) as in these examples:
Content-Type: multipart/alternative;
boundary="106493654088256";
class-id=2:7dHScNImUABLVHAHX3omUA:1738023
Content-Type: text/plain; charset=us-ascii; class-id=2:5BrQ7RNUzCDbwrCr3G9UzC:1738023
Content-Type: text/html; charset=us-ascii; class-id=2:4O40LtDu6zISq4z4eMKu6z:1738023
I couldn't find any specifications for Content-Type in RFC 822 , which is used by JavaMail.
I don't have control over what the incoming E-Mail messages contain.
Because mimeMultipart.getCount(); throws the above exceptions, I'm unable to count the number of body parts in the e-mails that have these special characters (colon, equals sign) in the Content-Type header.
I am catching the above exception though, so the processing of the rest of the e-mails continues without interruption.
However, is there any way I could get the count of the body parts in a MimeMultipart message that has problematic Content-Types as shown above?
Should I file a bug?
javax.mail.internet.ParseException: Expected';', got"="
at javax.mail.internet.ParameterList.<init>(ParameterList.java:179)
at javax.mail.internet.ContentType.<init>(ContentType.java:100)
at javax.mail.internet.MimeMultipart.parsebm(MimeMultipart.java:651)
In the above case the Content-Types in the Multipart email message are as follows:
Content-Type: multipart/alternative; boundary=-=_NextPart_boundary_000_aPpABvk398f_v.2.0.ENC7bin
=_NextPart_boundary_000_aPpABvk398f_v.2.0.ENC7bin
Content-Type: text/plain; charset=us-ascii
java version "1.5.0_11"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode, sharing)
JavaMail version 1.4
-
I searched everywhere, but couldn't find a solution. Most people are facing this problem.
Any help is appreciated.

