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

stax component can cause infinite loop of file component

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 2.24.2
    • 3.0.0
    • camel-stax
    • None
    • Unknown

    Description

      I discovered a situation where the stax component causes an infinite loop of the file component in case of invalid UTF-8 characters in the file. I attached a sample project with the most simplistic route that shows the behaviour: staxSample.zip

      The input file containes invalid UTF-8 characters. The route definition is as following:

      from("file://inbound?moveFailed=.failed")
          .split(stax(Product.class))
              .log("${body.name}");
      

      I get the exceptions

      Error renaming file from C:\Users\...\inbound\products.xml to inbound\.failed\products.xml

      and

      [javax.xml.stream.XMLStreamException: ParseError at [row,col]:[4,29]
      Message: Ungültiges Byte 2 von 3-Byte-UTF-8-Sequenz.]

      When I marshal the whole document at once I don't get the first exception. When I use the splitter with tokenizeXML I won't get any of the exceptions.


      The sample contains another example where a combination of Splitter with aggregation + seda route called by inOut and an exception in the seda route causes the infinite loop too (Message is "error renaming file" as above).

      I could figure out that the issue doesn't occur if at least one of the following changes:

      • the Exception is thrown in the "file"-route instead of in the seda route
      • the aggregation returns the newExchange if the oldExchange is null instead of creating a new DefaultExchange
      • "to" instead of "inOut" is used to call the seda endpoint

      Attachments

        1. staxSample.zip
          59 kB
          tomahi

        Activity

          People

            davsclaus Claus Ibsen
            tomahi tomahi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: