Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modello does not enforce uniqueness of Properties #78

Open
michael-o opened this issue Nov 21, 2020 · 0 comments
Open

Modello does not enforce uniqueness of Properties #78

michael-o opened this issue Nov 21, 2020 · 0 comments

Comments

@michael-o
Copy link
Member

This comes from https://issues.apache.org/jira/browse/MNG-6227

Consider declare a field which maps to {{java.util.Properties}}, the field is named props:

<props>
  <pr0n>awesome</pr0n>
  <pr0n>horrible</pr0n>
</props>

The latter will overrwite the former:

            else if ( checkFieldWithDuplicate( parser, "props", null, parsed ) )
            {
                InputLocation _locations;
                _locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
                model.setLocation( "props", _locations );
                while ( parser.nextTag() == XmlPullParser.START_TAG )
                {
                    String key = parser.getName();
                    _location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
                    _locations.setLocation( key, _location );
                    String value = parser.nextText().trim();
                    model.addProperty( key, value );
                }
            }

Either Modello should make behavior configurate or it should use a nested parsed set with checkFieldWithDuplicate() to enforce uniqueness and fail on duplicity. Everything else slips through and leads to undesired behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant