David Humeniuk created FELIX-4665: ------------------------------------- Summary: Metatype service does not allow a default empty string in XML resource Key: FELIX-4665 URL: https://issues.apache.org/jira/browse/FELIX-4665 Project: Felix Issue Type: Bug Components: Metatype Service Affects Versions: metatype-1.0.10 Reporter: David Humeniuk
An entry like the following will be treated as invalid and the default will change to null instead of an empty string: {code} <AD id="string.prop" cardinality="0" required="false" default="" type="String" description="Some string property"/> {code} MetaDataReader.readAD() method will first set the default value, then later check if the value is required: {code} ad.setDefaultValue( this.getOptionalAttribute( "default" ) ); ad.setRequired( this.getOptionalAttribute( "required", true ) ); {code} However, setDefaultValue method will check if the value is required (before it is known) in ADValidator.validateString(): {code} if (ad.isRequired() && ((value == null) || (length == 0))) { // Possible if the cardinality != 0 and input was something like // "0,,1"... return AD.VALIDATE_MISSING; } {code} The call to isRequired() will always be true at the time of the call. -- This message was sent by Atlassian JIRA (v6.3.4#6332)