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

camel-bindy - Multiple models in the same package lead to unpredictable results

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.9.6, 2.10.4
    • 2.11.0
    • camel-bindy
    • None
    • Unknown

    Description

      BindyCsvDataFormat only holds one model. When multiple models are defined in the same package or field positions overlap, only one @DataField is kept (the last one) overwriting the previous mapping. This leads to unpredictable behavior, from the wrong field value being populated, to format mismatch exceptions for fields of different types.

      This behavior is by design, as camel supports deep models, spread over multiple files (see AnnotationModelLoader.loadModels() implementation where whole packages are scanned).

      The documentation is rather vague, but I believe supporting multiple models in the same package is not really feasible, and overkill at best. Therefore my preference would be to keep the functionality as is and document the limitation.

      Currently the BindyCVSFieldEndingWithSeparatorIssueTest fails due to a conflict between MyCsvRecord.class and BindyDoubleQuotesCsvUnmarshallTest.Order.class defined in the same package. Moving MyCsvRecord to a different package is a trivial fix. I will look into adding some model validation as well to WARN if the model is inconsistent (i.e. has overlaps or gaps).

      Attachments

        Activity

          People

            hadrian Hadrian Zbarcea
            hadrian Hadrian Zbarcea
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: