Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-10704

XSLT will fail if the XML document contains a default namespace

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.17.4, 2.18.1
    • 2.17.5, 2.18.2, 2.19.0
    • camel-saxon
    • None
    • Unknown
    • Regression

    Description

      Any XSLT transformation will fail if the XML document that needs to be transformed contains a default namespace and camel-saxon is present.

      The same transformation will just work fine without camel-saxon (e.g. if the test is executed in camel-core).

      Example: If you try to transform the following XML document with XSLT and have camel-saxon in the classpath, an exception will be thrown:

      <?xml version="1.0" encoding="UTF-8"?>
      <Message xmlns="http://www.camel.apache.org/envelope">
          <Version>2.0</Version>
      </Message>
      
      org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[ID-WDFN34057358A-51410-1484310448314-0-2]
      	at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1710)
      	at org.apache.camel.util.ExchangeHelper.extractResultBody(ExchangeHelper.java:677)
      	at org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:515)
      	at org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:511)
      	at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:163)
      	at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:168)
      	at org.apache.camel.component.xslt.PayloadWithDefaultNamespaceTest.test_map_only(PayloadWithDefaultNamespaceTest.java:38)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      	at java.lang.reflect.Method.invoke(Unknown Source)
      	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
      	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
      	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
      	at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
      	at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
      	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
      	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
      	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
      	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
      	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
      	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
      	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
      Caused by: java.lang.NullPointerException
      	at net.sf.saxon.event.ReceivingContentHandler.startPrefixMapping(ReceivingContentHandler.java:269)
      	at org.apache.camel.converter.jaxp.StAX2SAXSource.parse(StAX2SAXSource.java:140)
      	at org.apache.camel.converter.jaxp.StAX2SAXSource.parse(StAX2SAXSource.java:343)
      	at net.sf.saxon.event.Sender.sendSAXSource(Sender.java:451)
      	at net.sf.saxon.event.Sender.send(Sender.java:153)
      	at net.sf.saxon.Controller.makeSourceTree(Controller.java:1927)
      	at net.sf.saxon.s9api.XsltTransformer.transform(XsltTransformer.java:573)
      	at net.sf.saxon.jaxp.TransformerImpl.transform(TransformerImpl.java:185)
      	at org.apache.camel.builder.xml.XsltBuilder.process(XsltBuilder.java:141)
      	at org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:103)
      	at org.apache.camel.component.xslt.XsltEndpoint.onExchange(XsltEndpoint.java:131)
      	at org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:71)
      	at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
      	at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:145)
      	at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:541)
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
      	at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:62)
      	at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
      	at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:97)
      	at org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:529)
      	at org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:1)
      	at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:365)
      	at org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:497)
      	at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:225)
      	at org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:144)
      	at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:161)
      	... 31 more
      

      Attachments

        Activity

          People

            siano Stephan Siano
            siano Stephan Siano
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: