Community
Participate
Working Groups
Using Eclipse 3.5M2 A component's <property> element has an optional "value" attribute. The two legal forms are used to: - Define a SINGLE property value, using the "value" attribute. <property name="ports" type="Integer" value="80"> - Define an ARRY of property values, using <property> content instead of the "value" attribute: <property name="ports" type="Integer"> 80, 8080 </property> So, the following should be flagged as a WARNING, since it uses both the "value" attribute AND has contents. <property name="ports" type="Integer" value="80"> 80, 8080 </property> Section 112.4.5 of the OSGi spec has this to say about using <property> element's content to define an ARRAY of values. Emphasis is mine. - "If the value attribute is not specified, the body of the property element MUST contain one or more values." - "Values MUST be placed one per line and blank lines are ignored." - "Parsing of the value is done by the parse methods in the class identified by the type, after trimming the line of any beginning and ending white space." These 3 pieces of information from the spec should help define the necessary validation for the <property> element. While some might see this level of validation as unnecessary, the selling point for PDE is that it catches runtime errors for you during development. I realize that I'm probably preaching to the choir here, but I felt it was good to mention.
Feel like making enhancements to the error report Rafael?
Created attachment 113935 [details] ErrorReporter updates Now we check: -If value attr is blank or null, we must define a body value -If value attr is not blank or null, we cannont define a body value Chris, could you please check the messages... Doubt: Is that ok to create a new 'property' with warning? Because we don't use any default value for new 'property' elements, right? Should we? :)
we should give a default value maybe a string type with value 'value' Can you address that too?
sure!
Created attachment 113936 [details] DSProperty update Now we create a default value for property elements. (the previous patch is still a valid one, ok?)
Thanks! :D
done. > 20090930
Chris, I would like to see the following marked as illegal, since having both a value attribute (even one with any empty string) and element content is wrong: <property name="property1" type="Integer" value=""> 10 </property> The value="" should probably be identified as the error.
Fixed Simon's case. Also fixed some wording issues. Also fixed a potential invalid thread access issue. Thanks Simon.
This should be legal, but is currently marked with a warning: <property name="foo" type="String" value=""/> The warning is: If the ''value'' attribute is not specified, the body of the property element must contain one or more values. This, of course, is a special case since a property of type "String" can have "" as the value, which equates to an empty string. A corner case for sure. I've tested this with Equinox's implementation of DS and it is legal.