javaee / metro-jax-ws

https://javaee.github.io/metro-jax-ws/
Other
132 stars 68 forks source link

XmlDataContentHandler should accept mime-types case-insensitiv #1176

Open glassfishrobot opened 9 years ago

glassfishrobot commented 9 years ago

We are using JASWX-RT in our Webapplication. If we receive a email with the content-type "application/XML" (XML upper case) an exception is thrown by com.sun.xml.ws.encoding.XmlDataContentHandler:

java.io.IOException: Cannot convert DataSource with content type "application/XML" to object in XmlDataContentHandler
    at com.sun.xml.ws.encoding.XmlDataContentHandler.getContent(XmlDataContentHandler.java:100)
    at javax.activation.DataSourceDataContentHandler.getContent(DataHandler.java:795)
    at javax.activation.DataHandler.getContent(DataHandler.java:542)
    at javax.mail.internet.MimeMessage.getContent(MimeMessage.java:1420)

The content-check should be change to accept also this mime-types.

Affected Versions

[2.2.10]

glassfishrobot commented 9 years ago

Reported by martin_lpz

glassfishrobot commented 9 years ago

martin_lpz said: My fix was this:

private boolean isXml(ContentType ct) {
        return ct.getSubType().equalsIgnoreCase("xml") &&
    (ct.getPrimaryType().equalsIgnoreCase("text") || ct.getPrimaryType().equalsIgnoreCase("application"));
    }
glassfishrobot commented 7 years ago

This issue was imported from java.net JIRA JAX_WS-1176