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

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

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.0, 1.6.0, 2.0-M1, 1.6.1, 2.0-M2, 2.0-M3, 2.0.0
    • Fix Version/s: 1.6.2, 2.1.0
    • Component/s: camel-core
    • Labels:
      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

            • Assignee:
              njiang Willem Jiang
              Reporter:
              njiang Willem Jiang

              Dates

              • Created:
                Updated:
                Resolved:

                Issue deployment