title: Apache Camel: CXF - returning Holder values (error: IndexOutOfBoundsException: Index: 1, Size: 1)
body: <p>I have a problem with setting holders in my output message.
  I have following simple routing and processor:</p>
  
  <pre><code>from("cxf:bean:ewidencjaEndpoint")
      .process(new ProcessResult())
      .end();
  
  public class ProcessResult implements Processor {
  
      public void process(Exchange exchange) throws Exception {
  
          Object[] args =  exchange.getIn().getBody(Object[].class);
  
          long id = (long) args[0];
          Holder&lt;A&gt; dataA = (Holder&lt;A&gt;) args[1];
          Holder&lt;B&gt; dataB = (Holder&lt;B&gt;) args[2];
  
          exchange.getOut().setBody(new Object[]{ dataA, dataB});
  
  }
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
  at java.util.ArrayList.RangeCheck(ArrayList.java:547)
  at java.util.ArrayList.get(ArrayList.java:322)
  at org.apache.cxf.jaxws.interceptors.HolderInInterceptor.handleMessage(HolderInInterceptor.java:67)
  at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:255)
  at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:737)
  at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:2335)
  at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream$1.run(HTTPConduit.java:2198)
  </code></pre>
  
  <p>I've read many similar problems descriped on web (ie.: <a href="http://camel.465427.n5.nabble.com/java-lang-IndexOutOfBoundsException-in-cxf-producer-td468541.html" rel="nofollow">http://camel.465427.n5.nabble.com/java-lang-IndexOutOfBoundsException-in-cxf-producer-td468541.html</a>) but without any success in resolving the problem.</p>
  
  <p>In debug I get output message like:</p>
  
  <pre><code>Exchange[Message[null,null, A@xxxm B@yyy]]
  </code></pre>
  
  <p>I don't understand what the foolowing "null" values come from.
  I've got only 2 outputs values (in Holders) according to wsdl file (and generated interface). I see also in debug console that in 'out' part of exchange body I have only 2 values set in ProcessResult()(idexed from 2 to 3), and size value of the 'out' part is set to '4' (not 2) ?</p>