DefaultCxfBinding fails with NullPointerException if any exchange header has a null value

Solution Verified - Updated -

Issue

  • While attempting to implement a custom header filter strategy, we ran into a unit test failure originating in our FailoverLoadBalancer class that we backported from Fuse 6.2. On further investigation it appears that the DefaultCxfBinding class does not handle exchange headers with null values. This code from Camel 2.15.1 camel-cxf jar in the DefaultCxfBinding class,
                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 null if it is supported.
  • Its a Code level problem. The issue occurred in the camel-core's FailoverLoadBalancer class that 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.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.