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

Throw meaningful exception of a streamed body has been consumed already

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.16.3
    • 2.19.0
    • camel-cxf
    • None
    • Unknown

    Description

      As I see in CAMEL-9864 there is an incompatible change about the usage of http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/Message.html#getBody%28java.lang.Class%29 in case the underlying body is subject to streaming.

      I understand the reasons for that change, but usually Java getters are assumed to be not modifying the underlying object.
      So it would be nice to add a small hint in the API that indicates that getBody may not be callable multiple times (esp. in context of streams)
      In case a stream was already consumed throwing a meaningful exception with a hint about how to fix this (either not call the method altogether or switching on stream caching ...) would be great.

      Attachments

        Issue Links

          Activity

            People

              davsclaus Claus Ibsen
              jkindler J├╝rgen Kindler
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: