You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Claus Ibsen (JIRA)" <ji...@apache.org> on 2008/04/12 10:03:43 UTC

[jira] Commented: (CAMEL-457) Camel should raise an exception if parsing of xslt file fails

    [ https://issues.apache.org/activemq/browse/CAMEL-457?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=42221#action_42221 ] 

Claus Ibsen commented on CAMEL-457:
-----------------------------------

Torsten the bug must be a ServiceMix only.

In pure Camel I do get a compile stylesheet error during creating of the routes.

Using this simple unit route builder where invalid.xsl is your xsl file with no changes.
{code}
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            public void configure() throws Exception {
                from("seda:a").to("xslt:org/apache/camel/component/xslt/invalid.xsl");
            }
        };
    }
{code}


{code}
ERROR:  'line 35: Variable or parameter 'datetimemod' is undefined.'
FATAL ERROR:  'Could not compile stylesheet'

org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: xslt:org/apache/camel/component/xslt/invalid.xsl due to: javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet
	at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:260)
	at org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:52)
	at org.apache.camel.model.RouteType.resolveEndpoint(RouteType.java:92)
	at org.apache.camel.impl.RouteContext.resolveEndpoint(RouteContext.java:95)
	at org.apache.camel.impl.RouteContext.resolveEndpoint(RouteContext.java:104)
	at org.apache.camel.model.ToType.resolveEndpoint(ToType.java:78)
	at org.apache.camel.model.ToType.createProcessor(ToType.java:72)
	at org.apache.camel.model.ProcessorType.makeProcessor(ProcessorType.java:1385)
	at org.apache.camel.model.ProcessorType.addRoutes(ProcessorType.java:93)
	at org.apache.camel.model.RouteType.addRoutes(RouteType.java:189)
	at org.apache.camel.model.RouteType.addRoutes(RouteType.java:83)
	at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:438)
	at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:430)
	at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:47)
	at org.apache.camel.ContextTestSupport.startCamelContext(ContextTestSupport.java:108)
	at org.apache.camel.ContextTestSupport.setUp(ContextTestSupport.java:81)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Caused by: javax.xml.transform.TransformerConfigurationException: Could not compile stylesheet
	at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTemplates(TransformerFactoryImpl.java:824)
	at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl.newTransformer(TransformerFactoryImpl.java:619)
	at org.apache.camel.builder.xml.XsltBuilder.setTransformerSource(XsltBuilder.java:204)
	at org.apache.camel.builder.xml.XsltBuilder.setTransformerInputStream(XsltBuilder.java:234)
	at org.apache.camel.component.xslt.XsltComponent.createEndpoint(XsltComponent.java:66)
	at org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:71)
	at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:236)
	... 33 more
{code}

> Camel should raise an exception if parsing of xslt file fails
> -------------------------------------------------------------
>
>                 Key: CAMEL-457
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-457
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 1.3.0
>         Environment: Camel 1.3.2.0, xslt component
>            Reporter: Torsten Mielke
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 1.4.0
>
>         Attachments: CAMEL-457.patch, CamelXSLTTestcase.zip
>
>
> Consider a Camel route that involves an xslt component. When Camel sets up the route, the XsltBuilder ignores any errors coming from the xerces xml parser and continues constructing the route even though the xslt transformer is not initialized. 
> Later when the route is executed Camel correctly checks if the transformer is initialized and raises an error if not:
> java.lang.IllegalArgumentException: No transformer configured!
> However in case of a parse error in the xslt file, the whole route becomes unusable and the setup routine that constructs the route should fail with an appropriate error message. A sanity check needs to be added in method
> org.apache.camel.builder.xml.XsltBuilder.setTransformerSource(javax.xml.transform.Source).

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