You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Hadrian Zbarcea (JIRA)" <ji...@apache.org> on 2013/04/02 22:09:15 UTC

[jira] [Created] (CAMEL-6234) Multiple models in the same package lead to unpredictable results

Hadrian Zbarcea created CAMEL-6234:
--------------------------------------

             Summary: Multiple models in the same package lead to unpredictable results
                 Key: CAMEL-6234
                 URL: https://issues.apache.org/jira/browse/CAMEL-6234
             Project: Camel
          Issue Type: Bug
          Components: camel-bindy
    Affects Versions: 2.10.4, 2.9.6
            Reporter: Hadrian Zbarcea
            Assignee: Hadrian Zbarcea
             Fix For: 2.11.0


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).



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira