You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by "Myles Bunbury (JIRA)" <ji...@apache.org> on 2010/07/08 21:34:49 UTC

[jira] Created: (WSCOMMONS-550) OMTextImpl.getText() only works once with a datahandler

OMTextImpl.getText() only works once with a datahandler
-------------------------------------------------------

                 Key: WSCOMMONS-550
                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-550
             Project: WS-Commons
          Issue Type: Bug
          Components: AXIOM
    Affects Versions: Axiom 1.2.8
            Reporter: Myles Bunbury


When OMTextImpl relies on an underlying datahandler's inputstream, a call to getText() can be a one shot deal. Once the datahandler's inputstream is consumed, the encapsulated data is lost and subsequent calls to getText() return "".

I ran into this situation using Synapse with debug logging enabled. A debug log message printed out the entire SOAP envelope to the log, thereby consuming the binary data wrapped by OMTextImpl. When later on the SOAP envelope was transmitted via the SendMediator, the OMTextImpl could no longer supply the data.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (WSCOMMONS-550) OMTextImpl.getText() only works once with a datahandler

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

Andreas Veithen reassigned WSCOMMONS-550:
-----------------------------------------

    Assignee: Andreas Veithen

> OMTextImpl.getText() only works once with a datahandler
> -------------------------------------------------------
>
>                 Key: WSCOMMONS-550
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-550
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: AXIOM
>    Affects Versions: Axiom 1.2.8
>            Reporter: Myles Bunbury
>            Assignee: Andreas Veithen
>
> When OMTextImpl relies on an underlying datahandler's inputstream, a call to getText() can be a one shot deal. Once the datahandler's inputstream is consumed, the encapsulated data is lost and subsequent calls to getText() return "".
> I ran into this situation using Synapse with debug logging enabled. A debug log message printed out the entire SOAP envelope to the log, thereby consuming the binary data wrapped by OMTextImpl. When later on the SOAP envelope was transmitted via the SendMediator, the OMTextImpl could no longer supply the data.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WSCOMMONS-550) OMTextImpl.getText() only works once with a datahandler

Posted by "Myles Bunbury (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WSCOMMONS-550?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12886424#action_12886424 ] 

Myles Bunbury commented on WSCOMMONS-550:
-----------------------------------------

Suggested fix, based on the v1.2.8 code:

In OMTextImpl.getText(), change:
              return TextHelper.toString(getInputStream());
to:
              this.value = TextHelper.toString(getInputStream());
              
              return this.value;

The idea is to discountinue use of the inputstream, and store the string that's been generated for future use. Perhaps some cleanup of the original datahandler would be useful too.

> OMTextImpl.getText() only works once with a datahandler
> -------------------------------------------------------
>
>                 Key: WSCOMMONS-550
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-550
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: AXIOM
>    Affects Versions: Axiom 1.2.8
>            Reporter: Myles Bunbury
>
> When OMTextImpl relies on an underlying datahandler's inputstream, a call to getText() can be a one shot deal. Once the datahandler's inputstream is consumed, the encapsulated data is lost and subsequent calls to getText() return "".
> I ran into this situation using Synapse with debug logging enabled. A debug log message printed out the entire SOAP envelope to the log, thereby consuming the binary data wrapped by OMTextImpl. When later on the SOAP envelope was transmitted via the SendMediator, the OMTextImpl could no longer supply the data.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (WSCOMMONS-550) OMTextImpl.getText() only works once with a datahandler

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

Andreas Veithen resolved WSCOMMONS-550.
---------------------------------------

    Resolution: Invalid

For a node with binary data, OMTextImpl#getText will ultimately call DataSource#getInputStream (for every invocation of getText). In the current code this is actually done indirectly via DataHandler#writeTo. The Javadoc of DataSource#getInputStream clearly specifies that "a new InputStream object must be returned each time this method is called, and the stream must be positioned at the beginning of the data." Therefore your claim that OMTextImpl "consumes" the datahandler's inputstream is incorrect. The real root cause of this problem is that the DataSource implementation violates the contract specified by the DataSource interface. Therefore you need to identify the DataSource implementation that is used here and fix it (if it is part of your code) or report a bug (if it is provided by an existing framework).

> OMTextImpl.getText() only works once with a datahandler
> -------------------------------------------------------
>
>                 Key: WSCOMMONS-550
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-550
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: AXIOM
>    Affects Versions: Axiom 1.2.8
>            Reporter: Myles Bunbury
>            Assignee: Andreas Veithen
>
> When OMTextImpl relies on an underlying datahandler's inputstream, a call to getText() can be a one shot deal. Once the datahandler's inputstream is consumed, the encapsulated data is lost and subsequent calls to getText() return "".
> I ran into this situation using Synapse with debug logging enabled. A debug log message printed out the entire SOAP envelope to the log, thereby consuming the binary data wrapped by OMTextImpl. When later on the SOAP envelope was transmitted via the SendMediator, the OMTextImpl could no longer supply the data.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WSCOMMONS-550) OMTextImpl.getText() only works once with a datahandler

Posted by "Myles Bunbury (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WSCOMMONS-550?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12886425#action_12886425 ] 

Myles Bunbury commented on WSCOMMONS-550:
-----------------------------------------

A quick scan of the OMTextImpl.java file in trunk indicates that this issue is likely still in the code, even though there has been some changes involving base 64 encoding in this area.

> OMTextImpl.getText() only works once with a datahandler
> -------------------------------------------------------
>
>                 Key: WSCOMMONS-550
>                 URL: https://issues.apache.org/jira/browse/WSCOMMONS-550
>             Project: WS-Commons
>          Issue Type: Bug
>          Components: AXIOM
>    Affects Versions: Axiom 1.2.8
>            Reporter: Myles Bunbury
>
> When OMTextImpl relies on an underlying datahandler's inputstream, a call to getText() can be a one shot deal. Once the datahandler's inputstream is consumed, the encapsulated data is lost and subsequent calls to getText() return "".
> I ran into this situation using Synapse with debug logging enabled. A debug log message printed out the entire SOAP envelope to the log, thereby consuming the binary data wrapped by OMTextImpl. When later on the SOAP envelope was transmitted via the SendMediator, the OMTextImpl could no longer supply the data.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.