[ 
https://issues.apache.org/jira/browse/SYNAPSE-218?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12555019
 ] 

Andreas Veithen commented on SYNAPSE-218:
-----------------------------------------

The effect of point 1 (and the fact that VFSTransportSender relies on the 
behavior described there) can be seen on the following sequence:

  <sequence name="in">
    <xslt key="encoding_test.xslt"/>
    <log level="full"/>
    <send>
      <endpoint>
        <address 
uri="vfs:file:///Users/veithen/workspace/synapse-vfs-test/data/out"/>
      </endpoint>
    </send>
  </sequence>

The log mediator will cause the OMSourcedElementImpl to be expanded. In this 
case, OMSourcedElementImpl#serializeAndConsume will no longer delegate to 
OMDataSource#serialize but to OMElementImpl#serializeAndConsume, which includes 
the wrapper element in its output, leading to an unexpected result.

The effect of point 3 can be seen on the following sequence:

  <sequence name="in">
    <xslt key="encoding_test.xslt"/>
    <send>
      <endpoint>
        <address 
uri="vfs:file:///Users/veithen/workspace/synapse-vfs-test/data/out"/>
      </endpoint>
    </send>
    <send>
      <endpoint>
        <address 
uri="vfs:file:///Users/veithen/workspace/synapse-vfs-test/data/out2"/>
      </endpoint>
    </send>
  </sequence>

Sending to the first endpoint will consume the input stream, causing an empty 
file to be sent to the second endpoint.

> TextFileDataSource violates OMDataSource contract
> -------------------------------------------------
>
>                 Key: SYNAPSE-218
>                 URL: https://issues.apache.org/jira/browse/SYNAPSE-218
>             Project: Synapse
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: NIGHTLY
>            Reporter: Andreas Veithen
>            Priority: Minor
>
> TextFileDataSource is an implementation of OMDataSource representing text 
> wrapped inside a <text> element. However, it doesn't respect the contract of 
> OMDataSource:
> 1) serialize(OutputStream, OMOutputFormat) doesn't output the <text> wrapper 
> element (actually the code is commented out) and doesn't take into account 
> the character encoding specified by the OMOutputFormat.
> 2) serialize(Writer, OMOutputFormat) only outputs an empty <text> element.
> 3) TextFileDataSource will give unexpected results with multiple invocations 
> (of the same or different methods) on the same instance, because the 
> invocation of any of the methods consumes the InputStream.
> It should be noted that
> * VFSTransportSender relies on the behavior described in point 1;
> * the intention of the behavior described in point 2 is probably to avoid 
> dumping the entire text data when the message is logged.
> However, the described behavior might lead to unexpected results in other 
> situations.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to