[
https://issues.apache.org/jira/browse/SYNAPSE-211?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12592179#action_12592179
]
Andreas Veithen commented on SYNAPSE-211:
-----------------------------------------
You are right. I always wondered what is the default behavior if no
ErrorListener is registered. In the JDK 5, Sun added the following comment: "If
an application does not register its own custom ErrorListener, the default
ErrorListener is used which reports all warnings and errors to System.err and
does not throw any Exceptions. Applications are strongly encouraged to register
and use ErrorListeners that insure proper behavior for warnings and errors."
The default ErrorListener is indeed not appropriate and we need to use our own.
However, I believe that the way the ErrorListener is implemented for the moment
is incorrect because the TransformerException is stored in an attribute of the
XSLTMediator instance. This will not work if the XSLT mediator is executed
concurrently. Also I can't find any code that resets this attribute. Am I
missing something here or does this mean that after an error, any further
invocation of the mediator would trigger the same exception?
I think that the implementation of the error and fatalError methods should
simply look like this:
public void error(TransformerException e) throws TransformerException {
throw e;
}
public void fatalError(TransformerException e) throws TransformerException {
throw e;
}
What do you think?
> Improve performance in XSLTMediator when temporary files are used
> -----------------------------------------------------------------
>
> Key: SYNAPSE-211
> URL: https://issues.apache.org/jira/browse/SYNAPSE-211
> Project: Synapse
> Issue Type: Improvement
> Components: Core
> Affects Versions: 1.1, NIGHTLY
> Reporter: Andreas Veithen
> Priority: Minor
> Fix For: 1.2
>
>
> The XSLT mediator has a mechanism to stream the result of the transformation
> to a temporary file when its size exceeds some threshold (defined by
> BYTE_ARRAY_SIZE, which has a fixed value of 8192). However, when this
> happens, the transformation is actually triggered twice. During the first
> run, the result is sent to a FixedByteArrayOutputStream which will raise a
> SynapseException after the first 8192 bytes have been written. The
> transformation is then restarted using a FileOutputStream for the result.
> This is very bad for two reasons:
> * It introduced an overhead (the first attempt to execute the transformation)
> for every large XML that is processed.
> * It makes the choice of the threshold BYTE_ARRAY_SIZE difficult: a small
> value is bad for smaller XML documents (because temporary files are used
> where this is not necessary) but good for larger ones (because it reduces the
> overhead caused by the first transformation attempt); a large value is good
> for smaller XML documents (avoids temporary files) but bad for larger ones
> (increased overhead for the first transformation).
> A better approach would be to have an OutputStream implementation that will
> first write to a byte array and once the threshold is exceeded transparently
> switches to a temporary file, so that the transformation is always run only
> once.
--
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]