com.sun.xml.internal.messaging.saaj.packaging.mime.internet.ParseException Java Examples

The following examples show how to use com.sun.xml.internal.messaging.saaj.packaging.mime.internet.ParseException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MessageFactoryImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public SOAPMessage createMessage(MimeHeaders headers, XMLStreamReader reader) throws SOAPException, IOException {
    String contentTypeString = MessageImpl.getContentType(headers);

    if (listener != null) {
        throw new SOAPException("Listener OutputStream is not supported with XMLStreamReader");
    }

    try {
        ContentType contentType = new ContentType(contentTypeString);
        int stat = MessageImpl.identifyContentType(contentType);

        if (MessageImpl.isSoap1_1Content(stat)) {
            return new Message1_1Impl(headers,contentType,stat,reader);
        } else if (MessageImpl.isSoap1_2Content(stat)) {
            return new Message1_2Impl(headers,contentType,stat,reader);
        } else {
            log.severe("SAAJ0530.soap.unknown.Content-Type");
            throw new SOAPExceptionImpl("Unrecognized Content-Type");
        }
    } catch (ParseException e) {
        log.severe("SAAJ0531.soap.cannot.parse.Content-Type");
        throw new SOAPExceptionImpl(
            "Unable to parse content type: " + e.getMessage());
    }
}