Return-Path: X-Original-To: apmail-felix-dev-archive@www.apache.org Delivered-To: apmail-felix-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E09BFC774 for ; Wed, 21 Jan 2015 16:26:34 +0000 (UTC) Received: (qmail 71116 invoked by uid 500); 21 Jan 2015 16:26:34 -0000 Delivered-To: apmail-felix-dev-archive@felix.apache.org Received: (qmail 71043 invoked by uid 500); 21 Jan 2015 16:26:34 -0000 Mailing-List: contact dev-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list dev@felix.apache.org Received: (qmail 71031 invoked by uid 99); 21 Jan 2015 16:26:34 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Jan 2015 16:26:34 +0000 Date: Wed, 21 Jan 2015 16:26:34 +0000 (UTC) From: "J.W. Janssen (JIRA)" To: dev@felix.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (FELIX-4665) Metatype service does not allow a default empty string in XML resource MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/FELIX-4665?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] J.W. Janssen resolved FELIX-4665. --------------------------------- Resolution: Fixed Fix Version/s: metatype-1.0.12 Fixed in rev #1653581. > 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 > Fix For: metatype-1.0.12 > > > An entry like the following will be treated as invalid and the default will change to null instead of an empty string: > {code} > > {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)