title: Strange Apache Camel Exception
body: <p>I am trying to get JSON data from jetty endpoint (another service), create output data and send them to one or more CVS files. I have 2 routes - first one creates files for current date, based on cron settings, second one exposes jetty endpoint to create files for any specified date on GET request. They are exactly the same except starting point, I also tried to send messages from second endpoint to first one... In both cases CSV files are created but second route gives me org.apache.camel.TypeConversionException. My route is:</p>
  
  <pre><code>from(httpServer + "/lineups?throwExceptionOnFailure=false?httpMethodRestrict=GET")
  .routeId("manualStart")
  .setExchangePattern(ExchangePattern.InOnly)
  .setHeader(Exchange.HTTP_URI, simple(apiEndpoint + "/lineups"))
  .setHeader("target_date", simple("${in.header.date}"))
  .setHeader(Exchange.HTTP_QUERY, simple("date=${in.header.date}"))
  .setHeader(Exchange.HTTP_METHOD, constant("GET"))
  .to("https://dummyhost")
  .process(new MappingProcessor())
  .split(body())
  .setHeader("prefix", simple("${body.name}"))
  .process(new FileNameProcessor())
  .marshal(bindy)
  .aggregate(header("prefix"), new FileAggregationStrategy())
  .completionTimeout(60000L)
  .to("file:" + fileLocation + "?fileName=Nielsen.${in.header.prefix}.${in.header.target_date}.txt");
  </code></pre>
  
  <p>I get following exception:</p>
  
  <pre><code>16:41:50.493 [qtp1583020257-49] ERROR o.a.c.c.j.CamelContinuationServlet - Error processing request
  org.apache.camel.TypeConversionException: Error during type conversion from type: java.lang.String to the required type: java.io.InputStream with value 
  [com...beans.MyOutput@7c9c5406, com...beans.MyOutput@6e3e3511, com.... [Body clipped after 1000 chars, total length is 23865] due Failed to convert from type [java.util.ArrayList&lt;?&gt;] to type [java.io.InputStream] for value ...
  ...
  com....beans.MyOutput@6f0c8349]'; 
  
  nested exception is org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.util.ArrayList&lt;?&gt;] to type [java.io.InputStream]
      at org.apache.camel.impl.converter.BaseTypeConverterRegistry.createTypeConversionException(BaseTypeConverterRegistry.java:610)
      at org.apache.camel.impl.converter.BaseTypeConverterRegistry.convertTo(BaseTypeConverterRegistry.java:137)
      at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:72)
      at org.apache.camel.impl.MessageSupport.getBody(MessageSupport.java:47)
      at org.apache.camel.http.common.DefaultHttpBinding.doWriteDirectResponse(DefaultHttpBinding.java:396)
      at org.apache.camel.http.common.DefaultHttpBinding.doWriteResponse(DefaultHttpBinding.java:332)
      at org.apache.camel.http.common.DefaultHttpBinding.writeResponse(DefaultHttpBinding.java:264)
      at org.apache.camel.component.jetty.CamelContinuationServlet.service(CamelContinuationServlet.java:227)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
      at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:821)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1685)
      at org.apache.camel.component.jetty.CamelFilterWrapper.doFilter(CamelFilterWrapper.java:45)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1668)
      at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:581)
      at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1158)
      at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)
      at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1090)
      at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
      at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:119)
      at org.eclipse.jetty.server.Server.handleAsync(Server.java:567)
      at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:325)
      at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:242)
      at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:261)
      at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
      at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:75)
      at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:213)
      at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:147)
      at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)
      at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)
      at java.lang.Thread.run(Thread.java:745)
  Caused by: org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.util.ArrayList&lt;?&gt;] to type [java.io.InputStream] for value
  </code></pre>
  
  <p>My data format for CSV formatting:</p>
  
  <pre><code>DataFormat bindy = new BindyCsvDataFormat(MyOutput.class);
  </code></pre>
  
  <p>This is FileAggregationStrategy:</p>
  
  <pre><code>public class FileAggregationStrategy implements AggregationStrategy {
    @Override
    public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
      if (oldExchange == null) {
         return newExchange;
    }
      String oldBody = oldExchange.getIn().getBody(String.class);
      String newBody = newExchange.getIn().getBody(String.class);
      String body = oldBody + newBody;
      oldExchange.getIn().setBody(body);
      return oldExchange;
    }
  }
  </code></pre>
  
  <p>I tried to add .log() after each step and I see that exception is thrown on .aggregate.</p>
  
  <p>What could be wrong ? Another route started from </p>
  
  <pre><code>from("quartz://start/api_cron/?cron=" + cronExpression + "&amp;fireNow=true")
  </code></pre>
  
  <p>works without any exceptions.</p>