You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Han Hong Fang (JIRA)" <ji...@apache.org> on 2012/10/16 17:43:03 UTC

[jira] [Created] (CXF-4574) Incorrect return type of AttachmentPart.getContent()

Han Hong Fang created CXF-4574:
----------------------------------

             Summary: 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


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

[jira] [Commented] (CXF-4574) Incorrect return type of AttachmentPart.getContent()

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-4574?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13479673#comment-13479673 ] 

Willem Jiang commented on CXF-4574:
-----------------------------------

CXF doesn't provide the SAAJ implementation itself. Can you double check your class patch to see if you already put to SAAJ implementation there.
                
> 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

[jira] [Comment Edited] (CXF-4574) Incorrect return type of AttachmentPart.getContent()

Posted by "Han Hong Fang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-4574?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13479666#comment-13479666 ] 

Han Hong Fang edited comment on CXF-4574 at 10/19/12 6:51 AM:
--------------------------------------------------------------

I did some quick debugging, and found that the ByteArrayInputStream returned from AttachmentPart.getContent() is created in org.apache.cxf.helpers.LoadingByteArrayOutputStream.createInputStream().

Did I locate the java code incorrectly?
                
      was (Author: hanhongfang):
    I did some quick debugging, and found that the ByteArrayInputStream returned from AttachmentPart.getContent() is created in LoadingByteArrayOutputStream.createInputStream().

Did I locate the java code incorrectly?
                  
> 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

[jira] [Commented] (CXF-4574) Incorrect return type of AttachmentPart.getContent()

Posted by "Freeman Fang (JIRA)" <ji...@apache.org>.
    [ 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

[jira] [Resolved] (CXF-4574) Incorrect return type of AttachmentPart.getContent()

Posted by "Freeman Fang (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-4574?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Freeman Fang resolved CXF-4574.
-------------------------------

    Resolution: Won't Fix
      Assignee: Freeman Fang
    
> 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

[jira] [Commented] (CXF-4574) Incorrect return type of AttachmentPart.getContent()

Posted by "Freeman Fang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-4574?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13477493#comment-13477493 ] 

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

Hi,

The AttachmentPart.getContent() actually call into com.sun.xml.messaging.saaj.soap.AttachmentPartImpl.getContent(), this code is from Sun's SAAJ impl and it's out of CXF code base. So even if there's any conflict with SAAJ api doc, it's not something CXF can fix here.

Freeman
                
> 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
>
> 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

[jira] [Commented] (CXF-4574) Incorrect return type of AttachmentPart.getContent()

Posted by "Han Hong Fang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-4574?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13479666#comment-13479666 ] 

Han Hong Fang commented on CXF-4574:
------------------------------------

I did some quick debugging, and found that the ByteArrayInputStream returned from AttachmentPart.getContent() is created in LoadingByteArrayOutputStream.createInputStream().

Did I locate the java code incorrectly?
                
> 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