[ 
https://issues.apache.org/jira/browse/CXF-4574?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13479672#comment-13479672
 ] 

Freeman Fang commented on CXF-4574:
-----------------------------------

It doesn't matter who create the InputStream, the point here is that the  
AttachmentPart.getContent()  should return the expected object per the Java 
Doc. And as I mentioned before AttachmentPart.getContent() is call into 
com.sun.xml.messaging.saaj.soap.AttachmentPartImpl.getContent(), it's Sun's 
SAAJ impl, so it should be 
com.sun.xml.messaging.saaj.soap.AttachmentPartImpl.getContent() itself check 
Content-Type and change a InputStream to StreamSource if necessary.
                
> Incorrect return type of AttachmentPart.getContent()
> ----------------------------------------------------
>
>                 Key: CXF-4574
>                 URL: https://issues.apache.org/jira/browse/CXF-4574
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 2.6.2
>         Environment: Windows 7 + Oracle jdk 1.6.0_29
>            Reporter: Han Hong Fang
>            Assignee: Freeman Fang
>
> The java doc of javax.xml.soap.AttachmentPart.getContent() says:
> Gets the content of this AttachmentPart object as a Java object. The type of 
> the returned Java object depends on (1) the DataContentHandler object that is 
> used to interpret the bytes and (2) the Content-Type given in the header.
> For the MIME content types "text/plain", "text/html" and "text/xml", the 
> DataContentHandler object does the conversions to and from the Java types 
> corresponding to the MIME types. For other MIME types,the DataContentHandler 
> object can return an InputStream object that contains the content data as raw 
> bytes.
> A SAAJ-compliant implementation must, as a minimum, return a java.lang.String 
> object corresponding to any content stream with a Content-Type value of 
> text/plain, a javax.xml.transform.stream.StreamSource object corresponding to 
> a content stream with a Content-Type value of text/xml, a java.awt.Image 
> object corresponding to a content stream with a Content-Type value of 
> image/gif or image/jpeg. For those content types that an installed 
> DataContentHandler object does not understand, the DataContentHandler object 
> is required to return a java.io.InputStream object with the raw bytes. 
> But in cxf 2.6.2, when MIME content type is "text/xml", the return type of 
> AttachmentPart.getContent() is java.io.ByteArrayInputStream, which doesn't 
> comply with the java doc.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to