Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Java Mail fails to parse multipart Content-Type due to slash

Reply
Thread Tools

Java Mail fails to parse multipart Content-Type due to slash

 
 
Brian J. Sayatovic
Guest
Posts: n/a
 
      06-25-2004
I've narrowed down a problem I'm experiencing accepting an HTTP post
to a failure of the Java Mail API 1.1 portion of J2EE 1.2.1 to parse
the following Content-Type header:

Content-Type: Multipart/Related;boundary=100fb0c59b90341754298fa8a1cb5fe4; type=text/xml;start="<4d06a28035510812f8c507ecbcad32__>"

The flow is that a javax.mail.internet.ContentType is instantiated
with the value of the header, the type and subtype ("Multipart" and
"Related", respectively) are parsed, and then the paramemter list
needs to be parsed.

The parameter list is parsed by instantiating a
javax.mail.internet.ParameterList with the parameter list value. That
fails with a ParseException with no further information. Through
trial and error, I was able to determine that the forward slash ("/")
in the "type=text/xml" parameter of the parameter list is causing the
problem. By eliminating that slash (or that parameter altogether),
the parsing passes.

The trouble is, as far as I have found, having a slash as part of the
type parameter for a Multipart/Related Content-Type is perfectly legal
and even necessary! Why is it, then, that the Java Mail API can't
handle this?

Regards,
Brian.
 
Reply With Quote
 
 
 
 
Chris Uppal
Guest
Posts: n/a
 
      06-25-2004
Brian J. Sayatovic wrote:

> The trouble is, as far as I have found, having a slash as part of the
> type parameter for a Multipart/Related Content-Type is perfectly legal
> and even necessary! Why is it, then, that the Java Mail API can't
> handle this?


My reading of RFC 2045 (section 5.1) is that the

type=text/xml

bit is just a "parameter" according to the grammar. As such '/' is not a legal
value in an unquoted value string.

The '/' in Multipart/Related is legal without quotes (indeed quotes would not
be legal there), but that is a different case in the grammar.

In short, I think the content-type line should be (ignore the wrapping):

Content-Type: Multipart/Related; boundary=100fb0c59b90341754298fa8a1cb5fe4;
type="text/xml"; start="<4d06a28035510812f8c507ecbcad32__>"

and that JavaMail is correct to refuse it.

-- chris


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to due with "warning LNK4075: ignoring '/INCREMENTAL' due to Fresh C++ 2 04-22-2008 09:03 PM
DocumentBuilder object is not able to parse a XML String which has a nodename which contains forward slash! Ed Java 6 08-02-2007 03:29 PM
MIME Structure Multipart/Mixed with attachment and Multipart/Alternative blaine@worldweb.com Perl Misc 1 04-04-2007 08:23 PM
Links to https fails 404 with preceding forward slash Greg Collins [Microsoft MVP] ASP .Net 2 06-15-2006 07:17 PM
Mail::Bulkmail - multipart breaks when doing mail merge Patrick Perl Misc 0 02-17-2004 08:04 PM



Advertisments