dev@jersey.java.net

Re: Invalid media type

From: Julian Reschke <julian.reschke_at_gmx.de>
Date: Fri, 27 Jul 2007 12:19:04 +0200

Fred wrote:
> Yes, I have a [java.text.ParseException].
>
> You can reproduce this bug with the following code :
> MediaTypeProvider mediaTypeProvider = new MediaTypeProvider();
> mediaTypeProvider.fromString("multipart/form-data;
> boundary=Thread:0000_at_Round:0001");
>
> Stak trace :
> java.text.ParseException: Expected separator ';' instead of ':'
> at com.sun.ws.rest.impl.http.header.reader.HttpHeaderReader.nextSeparator(HttpHeaderReader.java:87)
> at com.sun.ws.rest.impl.http.header.reader.HttpHeaderReader.readParameters(HttpHeaderReader.java:215)
> at com.sun.ws.rest.impl.provider.header.MediaTypeProvider.fromString(MediaTypeProvider.java:73)
>
> Frédéric

As far as I can tell, "Thread:0000_at_Round:0001" is not a legal parameter
value. Check

<http://tools.ietf.org/html/rfc2045#section-5.1>

      parameter := attribute "=" value

      attribute := token
                   ; Matching of attributes
                   ; is ALWAYS case-insensitive.

      value := token / quoted-string

      token := 1*<any (US-ASCII) CHAR except SPACE, CTLs,
                  or tspecials>

      tspecials := "(" / ")" / "<" / ">" / "@" /
                    "," / ";" / ":" / "\" / <">
                    "/" / "[" / "]" / "?" / "="
                    ; Must be in quoted-string,
                    ; to use within parameter values


":" is in "tspecials", thus may not appear in an unquoted parameter value.

Best regards, Julian