Disallow setting a header with a null name
------------------------------------------

                 Key: CAMEL-1152
                 URL: https://issues.apache.org/activemq/browse/CAMEL-1152
             Project: Apache Camel
          Issue Type: Improvement
          Components: camel-core
         Environment: Any
            Reporter: Ramon Buckland
            Priority: Minor


I have found that it is possible to set the header "name" to null of a message.

You can set a null header name as follows.. 

 <setHeader name="someName"><constant>SUCCESS</constant></setHeader>

This task succeeds, (ie no error occurs) but not as you would expect, because 
this is what it is meant to be (@headerName)

<setHeader headerName="someName"><constant>SUCCESS</constant></setHeader>

eg: log dumping the header shows   -  Headers:{null=SUCCESS}

A side effect of this happening is that if you then use the xslt: component 
after setting a null header with a value, the xslt (saxon) component  freaks 
out with a NPE because it is attempting to set parameters for each header it 
finds, but the header is there and has a null name.  

A Snippet of the Stack Trace - 

java.lang.NullPointerException
        at 
net.sf.saxon.om.StructuredQName.fromClarkName(StructuredQName.java:70)
        at net.sf.saxon.Controller.setParameter(Controller.java:1979)
        at 
org.apache.camel.builder.xml.XsltBuilder.addParameters(XsltBuilder.java:290)
        at 
org.apache.camel.builder.xml.XsltBuilder.configureTransformer(XsltBuilder.java:276)
        at org.apache.camel.builder.xml.XsltBuilder.process(XsltBuilder.java:74)
        at 
org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:92)
        at 
org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:66)


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

Reply via email to