Alexander Berger created FELIX-3720:
---------------------------------------
Summary: Designate's pid attribute is optional and not mandatory
Key: FELIX-3720
URL: https://issues.apache.org/jira/browse/FELIX-3720
Project: Felix
Issue Type: Bug
Components: Metatype Service
Affects Versions: metatype-1.0.4
Reporter: Alexander Berger
In class org.apache.felix.metatype.MetaDataReader method readDesignate the
"pid" attribute of a "Designate" element is read as required attribute:
designate.setPid( this.getRequiredAttribute( "pid" ) );
designate.setFactoryPid( this.getOptionalAttribute( "factoryPid" ) );
This is wrong as according to the Metatype Service Specification (Version 1.2)
the attributes "pid" and "factoryPid" are both optional but at least one of
these two must be present (either "pid" or "factoryPid"). Thus the code should
be changed to something like this:
final String pid = this.getOptionalAttribute( "pid" );
final String factoryPid = this.getOptionalAttribute( "factoryPid" );
if ( pid == null && factoryPid == null ) {
missingAttribute("pid or factoryPid");
}
designate.setPid( pid );
designate.setFactoryPid( factoryPid );
--
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