Skip to content

Modello does not enforce uniqueness of Properties #78

Open
@michael-o

Description

@michael-o

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions