DefaultCxfBinding fails with NullPointerException if any exchange header has a null value
Issue
- While attempting to implement a custom header filter strategy, we ran into a unit test failure originating in our
FailoverLoadBalancerclass that we backported from Fuse 6.2. On further investigation it appears that theDefaultCxfBindingclass does not handle exchange headers with null values. This code from Camel 2.15.1 camel-cxf jar in theDefaultCxfBindingclass,
List<String> listValue = new ArrayList<String>();
listValue.add(entry.getValue().toString());
transportHeaders.put(entry.getKey(), listValue);
Line 685 tries to call toString() on the entry value and null pointers if the value is null.
- This should either throw a more specific error (if this is unsupported) or convert it to something more useful like the string
nullif it is supported. - Its a Code level problem. The issue occurred in the
camel-core's FailoverLoadBalancer classthat we have backported from 6.2 pending upgrade; however code inspection showed that it exists in 6.2 as well.
Environment
- Red Hat JBoss Fuse
- 6.2.0
- Apache Camel
- camel-cxf component
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
