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

Stream closed for onException with useOriginalMessage

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.18.0, 3.18.1, 3.18.2
    • 3.21.0, 4.0-M3, 4.0.0
    • camel-core
    • None
    • Unknown

    Description

      I seems that using onException().useOriginalMessage() with a stream input will always result in a closed stream. Uncached streams are closed upon reading and cached stream are since 3.18 also closed when converted.

      "Converter for InputStream to byte[] should close stream"
      https://issues.apache.org/jira/browse/CAMEL-18226

      When there is for example an .unmarshal().json() step in the route, and the exchange fails after this step, the original stream is closed and can't be used in the onException block.

      To demo the behavior I've created a simple example project: https://github.com/alvinkwekel/camel-steam-exception-example/tree/main/src/main/java/com/example/camel

      Attachments

        Issue Links

          Activity

            People

              davsclaus Claus Ibsen
              alvinkwekel@gmail.com Alvin Kwekel
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: