generating types programmatically is hard
-----------------------------------------

                 Key: NXP-3286
                 URL: http://jira.nuxeo.org/browse/NXP-3286
             Project: Nuxeo Enterprise Platform
          Issue Type: Bug
          Components: Core
    Affects Versions: 5.2 M4
         Environment: Any
            Reporter: Ian Smith
            Assignee: Thierry Delprat


The code for list type has a hack in it for field name == non null.  This is 
bad because it means that you can change your xsd (adding a field name) and get 
different behaviors.  Worse, I found this because I was generating types 
programmatically so I had no idea that this code path (set the field name or 
not) produced such different values.  

I can easily fix this to have a new type called "SlowListTypeImpl" that is used 
by all the code that goes through here (we know where it is, that's for sure) 
expecting to *not* get an array type out of ListTypeImpl.


    public ListTypeImpl(String schema, String name, TypeRef<? extends Type> 
type,
            String fieldName, String defaultValue, int minOccurs, int 
maxOccurs) {
        super(null, schema, name);
        if (fieldName == null) {
            isArray = true;
            fieldName = "item";
        }
        this.type = type;
        field = new FieldImpl(QName.valueOf(fieldName), getRef(), type);
        this.minOccurs = minOccurs;
        this.maxOccurs = maxOccurs;
        this.defaultValue = defaultValue;
    }


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.nuxeo.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
ECM-tickets mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm-tickets

Reply via email to