[ 
https://issues.apache.org/jira/browse/CAMEL-6991?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13829696#comment-13829696
 ] 

Ulrich Kramer commented on CAMEL-6991:
--------------------------------------

With the following example you can reproduce the problem when you set two 
breakpoints:

# CachedOutputStream line: 209  cleanUpTempFile()       
# FileInputStreamCache line: 110  createInputStream(File)       

cleanupTempFile is called first. createInputStream creates an IOException 
because the file is already removed.

{code}
        CamelContext context = new DefaultCamelContext();
        context.addRoutes(new RouteBuilder() {

            @Override
            public void configure() throws Exception {
                from("direct:input").to("jetty:http://localhost:55555/input";);
                from("jetty:http://localhost:55555/input";).process(new 
Processor() {

                    @Override
                    public void process(final Exchange exchange) throws 
Exception {
                        Assert.assertFalse(exchange.hasOut());
                    }
                });
            }
        });
        context.start();
        ProducerTemplate template = context.createProducerTemplate();
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < 10000; i++) {
            sb.append("0123456789");
        }
        template.sendBody("direct:input", sb.toString());
        while (true) {
            Thread.sleep(1000);
        }
{code}

> Problem with stream caching and DefaultHttpBinding.writeResponse
> ----------------------------------------------------------------
>
>                 Key: CAMEL-6991
>                 URL: https://issues.apache.org/jira/browse/CAMEL-6991
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-http
>    Affects Versions: 2.11.2
>         Environment: Debian 7
>            Reporter: Ulrich Kramer
>
> DefaultHttpBinding.writeResponse was modified between 2.11.0 and 2.11.2. This 
> yields to a problem with stream caching. 
> When exchange.out is not set target (DefaultHttpBinding.java:215)  is 
> assigned to exchange.in . exchange.in may contain a body which is already 
> removed by an onCompletion callback. In DefaultHttpBindung.java:377 this body 
> is read. This may yield to an exception



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to