Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Ross2011-11-18 22:16:04 +0000
committerJohn Ross2011-11-18 22:16:04 +0000
commit82fc12f75e778e1832afcd9eab8fb561269fca76 (patch)
treec70c00b130d78bb94a9ea648123997849d7ccd1a /bundles/org.eclipse.equinox.metatype
parente76b83ae31eb5092188f16117981690f0d4872d6 (diff)
downloadrt.equinox.bundles-82fc12f75e778e1832afcd9eab8fb561269fca76.tar.gz
rt.equinox.bundles-82fc12f75e778e1832afcd9eab8fb561269fca76.tar.xz
rt.equinox.bundles-82fc12f75e778e1832afcd9eab8fb561269fca76.zip
Bug 349189: Updates to AttributeDefinition.getDefaultValue.
These updates are based on the conclusions reached in https://www.osgi.org/members/bugzilla/show_bug.cgi?id=2182#c4.
Diffstat (limited to 'bundles/org.eclipse.equinox.metatype')
-rw-r--r--bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/AttributeDefinitionImpl.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/AttributeDefinitionImpl.java b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/AttributeDefinitionImpl.java
index 73d34da39..1adcbd212 100644
--- a/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/AttributeDefinitionImpl.java
+++ b/bundles/org.eclipse.equinox.metatype/src/org/eclipse/equinox/metatype/impl/AttributeDefinitionImpl.java
@@ -10,9 +10,8 @@
*******************************************************************************/
package org.eclipse.equinox.metatype.impl;
-import org.eclipse.equinox.metatype.EquinoxAttributeDefinition;
-
import java.util.*;
+import org.eclipse.equinox.metatype.EquinoxAttributeDefinition;
import org.eclipse.osgi.util.NLS;
import org.osgi.service.log.LogService;
@@ -258,14 +257,20 @@ public class AttributeDefinitionImpl extends LocalizationElement implements Equi
logger.log(LogService.LOG_WARNING, NLS.bind(MetaTypeMsg.INVALID_DEFAULTS, vt.getValuesAsString(), reason));
return;
}
- setDefaultValue(vt.getValuesAsArray());
+ String[] defaults = vt.getValuesAsArray();
+ // If the default value is a single empty string and cardinality != 0, the default value must become String[0].
+ // We know the cardinality has already been set in the constructor.
+ if (_cardinality != 0 && defaults.length == 1 && defaults[0].length() == 0)
+ setDefaultValue(new String[0]);
+ else
+ setDefaultValue(vt.getValuesAsArray());
}
/**
* Method to set the default value of AttributeDefinition.
* The given parameter is a String array of multi values.
*/
- void setDefaultValue(String[] defaults) {
+ private void setDefaultValue(String[] defaults) {
_defaults = defaults;
}

Back to the top