Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-1955

MessageSupport.copyFrom() doesn't clean the message header and the attachments

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.5.0, 1.6.0, 2.0-M1, 1.6.1, 2.0-M2, 2.0-M3, 2.0.0
    • 1.6.2, 2.1.0
    • camel-core
    • None

    Description

      If the we want to clean up the attachment in the pipeline processor, we will hit this bug.

       from("direct:start")
                          .process(new Processor() {
                              public void process(Exchange exchange) throws Exception {
                                  exchange.getOut().copyFrom(exchange.getIn());
                                  //Added the header and attachment
                                  exchange.getOut().setHeader("test", "testValue");
                                  exchange.getOut().addAttachment("test1.xml", new DataHandler(new FileDataSource("pom.xml")));
                              }
                          })
                          .process(new Processor() {
                              public void process(Exchange exchange) throws Exception {
                                  exchange.getOut().copyFrom(exchange.getIn());
                                  assertNotNull("The test attachment should not be null", exchange.getOut().getAttachment("test1.xml"));
                                  assertNotNull("The test header should not be null", exchange.getOut().getHeader("test"));
                                  exchange.getOut().removeAttachment("test1.xml");
                                  exchange.getOut().removeHeader("test");
                              }
                          });
      

      Attachments

        Issue Links

          Activity

            People

              njiang Willem Jiang
              njiang Willem Jiang
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: