saaj
  1. saaj
  2. SAAJ-63

com.sun.xml.messaging.saaj.packaging.mime.internet.ContentType.toString() produces unparsable string

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.3
    • Fix Version/s: 1.3.20
    • Component/s: code
    • Labels:
      None

      Description

      When one of the content type parameters is an empty string, ContentType.toString() produces a string that the constructor cannot parse. Test code:

      ContentType ct = new ContentType("application/soap+xml;charset=utf-8;action=\"\"");
      new ContentType(ct.toString());
      // -> ParseException
      

      This problem makes the com.sun.xml.messaging.saaj.soap.MessageImpl.setFinalContentType(String) fail when e.g. the action parameter of the content-type header is null.

          private void setFinalContentType(String charset) {
              ContentType ct = contentType();
              if (ct == null) {
                  ct = new ContentType();
              }
              String[] split = getExpectedContentType().split("/");
              ct.setPrimaryType(split[0]);
              ct.setSubType(split[1]);
              ct.setParameter("charset", charset);
              headers.setHeader("Content-Type", ct.toString());
          }
      

        Activity

        Hide
        kkamenev added a comment -

        A small correction:
        This problem makes the com.sun.xml.messaging.saaj.soap.MessageImpl.setFinalContentType(String) fail when e.g. the action parameter of the content-type header is a quoted empty string.

        Show
        kkamenev added a comment - A small correction: This problem makes the com.sun.xml.messaging.saaj.soap.MessageImpl.setFinalContentType(String) fail when e.g. the action parameter of the content-type header is a quoted empty string.
        Hide
        gagordon added a comment -

        Bug fixed in trunk revision 408 11/20/12 10:27 - Fix for JIRA issue SAAJ63: ContentType.toString() produces unparsable string. Not pushed to Maven repo yet.

        Show
        gagordon added a comment - Bug fixed in trunk revision 408 11/20/12 10:27 - Fix for JIRA issue SAAJ63: ContentType.toString() produces unparsable string. Not pushed to Maven repo yet.

          People

          • Assignee:
            gagordon
            Reporter:
            kkamenev
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: