You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Mark Borner <ma...@zurich.com.au> on 2011/01/31 00:50:30 UTC

XSLT Transformation Exceptions

Hello:

I'm using XSLT stylesheets in my routes.  These stylesheets call Java 
static methods to do database lookups.  It's possible that these lookups 
will throw exceptions if a lookup value cannot be found.  By default in 
XSLT if the stylesheet throws an exception, the transformation quietly 
ends and the result is an incomplete result - no exception is thrown.

When I code the transformation in Java, I have to set an ErrorListener in 
order for the transformation to throw an exception.

        Transformer transformer = 
TransformerFactory.newInstance().newTransformer(stylesheet);
            transformer.setErrorListener(new DefaultErrorHandler(true));
            transformer.transform(source, result);

When using Camel, I am experiencing the same issue - if the stylesheet 
throw an exception, the transformation is quietly ends with an incomplete 
result.  Is there a way to set an ErrorListener on the XSLT component?  Or 
can it be enhanced with this functionality?  I can provide a test case if 
that would be useful - let me know.

Thanks,
Mark

Mark Borner
Java Developer - ZStream Xpress

----
This email is intended for the named recipient only. It may contain 
information which is confidential, commercially sensitive, or 
copyright. If you are not the intended recipient you must not 
reproduce or distribute any part of the email, disclose its contents, 
or take any action in reliance. If you have received this email in 
error, please contact the sender and delete the message. It is your 
responsibility to scan this email and any attachments for viruses and 
other defects. To the extent permitted by law, Zurich and its 
associates will not be liable for any loss or damage arising in any 
way from this communication including any file attachments. We may 
monitor email you send to us, either as a reply to this email or any 
email you send to us, to confirm our systems are protected and for 
compliance with company policies. Although we take reasonable 
precautions to protect the confidentiality of our email systems, we 
do not warrant the confidentiality or security of email or 
attachments we receive.

Re: XSLT Transformation Exceptions

Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Jan 31, 2011 at 12:50 AM, Mark Borner <ma...@zurich.com.au>wrote:

>
> Hello:
>
> I'm using XSLT stylesheets in my routes.  These stylesheets call Java
> static methods to do database lookups.  It's possible that these lookups
> will throw exceptions if a lookup value cannot be found.  By default in XSLT
> if the stylesheet throws an exception, the transformation quietly ends and
> the result is an incomplete result - no exception is thrown.
>
> When I code the transformation in Java, I have to set an ErrorListener in
> order for the transformation to throw an exception.
>
>         Transformer transformer =
> TransformerFactory.newInstance().newTransformer(stylesheet);
>             transformer.setErrorListener(new DefaultErrorHandler(true));
>             transformer.transform(source, result);
>
> When using Camel, I am experiencing the same issue - if the stylesheet
> throw an exception, the transformation is quietly ends with an incomplete
> result.  Is there a way to set an ErrorListener on the XSLT component?  Or
> can it be enhanced with this functionality?  I can provide a test case if
> that would be useful - let me know.
>
>
Create a JIRA ticket and attach a test case. Then we can look into it.





>  Thanks,
> Mark
>
> Mark Borner
> Java Developer - ZStream Xpress
>
>
>
>
> ----
> This email is intended for the named recipient only. It may contain
> information which is confidential, commercially sensitive, or
> copyright. If you are not the intended recipient you must not
> reproduce or distribute any part of the email, disclose its contents,
> or take any action in reliance. If you have received this email in
> error, please contact the sender and delete the message. It is your
> responsibility to scan this email and any attachments for viruses and
> other defects. To the extent permitted by law, Zurich and its
> associates will not be liable for any loss or damage arising in any
> way from this communication including any file attachments. We may
> monitor email you send to us, either as a reply to this email or any
> email you send to us, to confirm our systems are protected and for
> compliance with company policies. Although we take reasonable
> precautions to protect the confidentiality of our email systems, we
> do not warrant the confidentiality or security of email or
> attachments we receive.
>
>


-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: XSLT Transformation Exceptions

Posted by Willem Jiang <wi...@gmail.com>.
Hi

I just created a JIRA[1] for it, and will commit a patch shortly.
[1]https://issues.apache.org/jira/browse/CAMEL-3602


On 1/31/11 7:50 AM, Mark Borner wrote:
>
> Hello:
>
> I'm using XSLT stylesheets in my routes. These stylesheets call Java
> static methods to do database lookups. It's possible that these lookups
> will throw exceptions if a lookup value cannot be found. By default in
> XSLT if the stylesheet throws an exception, the transformation quietly
> ends and the result is an incomplete result - no exception is thrown.
>
> When I code the transformation in Java, I have to set an ErrorListener
> in order for the transformation to throw an exception.
>
> Transformer transformer =
> TransformerFactory.newInstance().newTransformer(stylesheet);
> transformer.setErrorListener(new DefaultErrorHandler(true));
> transformer.transform(source, result);
>
> When using Camel, I am experiencing the same issue - if the stylesheet
> throw an exception, the transformation is quietly ends with an
> incomplete result. Is there a way to set an ErrorListener on the XSLT
> component? Or can it be enhanced with this functionality? I can provide
> a test case if that would be useful - let me know.
>
> Thanks,
> Mark
>
> Mark Borner
> Java Developer - ZStream Xpress
>
>
>
>
> ----
> This email is intended for the named recipient only. It may contain
> information which is confidential, commercially sensitive, or
> copyright. If you are not the intended recipient you must not
> reproduce or distribute any part of the email, disclose its contents,
> or take any action in reliance. If you have received this email in
> error, please contact the sender and delete the message. It is your
> responsibility to scan this email and any attachments for viruses and
> other defects. To the extent permitted by law, Zurich and its
> associates will not be liable for any loss or damage arising in any
> way from this communication including any file attachments. We may
> monitor email you send to us, either as a reply to this email or any
> email you send to us, to confirm our systems are protected and for
> compliance with company policies. Although we take reasonable
> precautions to protect the confidentiality of our email systems, we
> do not warrant the confidentiality or security of email or
> attachments we receive.
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang