Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
metatype-1.0.10
-
None
Description
An entry like the following will be treated as invalid and the default will change to null instead of an empty string:
<AD id="string.prop" cardinality="0" required="false" default="" type="String" description="Some string property"/>
MetaDataReader.readAD() method will first set the default value, then later check if the value is required:
ad.setDefaultValue( this.getOptionalAttribute( "default" ) ); ad.setRequired( this.getOptionalAttribute( "required", true ) );
However, setDefaultValue method will check if the value is required (before it is known) in ADValidator.validateString():
if (ad.isRequired() && ((value == null) || (length == 0))) { // Possible if the cardinality != 0 and input was something like // "0,,1"... return AD.VALIDATE_MISSING; }
The call to isRequired() will always be true at the time of the call.