Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2011-04-06 16:38:04 +0000
committerThomas Watson2011-04-06 16:38:04 +0000
commit909a7774ce8c9f25104f2de5eebcc39bda7fae56 (patch)
tree6b9603792a30598a2bebb76b2b63bd14f1f421c2 /bundles/org.eclipse.equinox.compendium.tests
parent9c1523b31d14d446a298004634f15f7a537b2c33 (diff)
downloadrt.equinox.bundles-909a7774ce8c9f25104f2de5eebcc39bda7fae56.tar.gz
rt.equinox.bundles-909a7774ce8c9f25104f2de5eebcc39bda7fae56.tar.xz
rt.equinox.bundles-909a7774ce8c9f25104f2de5eebcc39bda7fae56.zip
Bug 341963 - [metatype] StringIndexOutOfBoundsException when description or name attributes are an empty string
Diffstat (limited to 'bundles/org.eclipse.equinox.compendium.tests')
-rw-r--r--bundles/org.eclipse.equinox.compendium.tests/bundles_src/metatype/tb3/OSGI-INF/metatype/testfile.xml6
-rw-r--r--bundles/org.eclipse.equinox.compendium.tests/src/org/eclipse/equinox/metatype/tests/BugTests.java20
2 files changed, 26 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.compendium.tests/bundles_src/metatype/tb3/OSGI-INF/metatype/testfile.xml b/bundles/org.eclipse.equinox.compendium.tests/bundles_src/metatype/tb3/OSGI-INF/metatype/testfile.xml
index 4519a18e6..fce220908 100644
--- a/bundles/org.eclipse.equinox.compendium.tests/bundles_src/metatype/tb3/OSGI-INF/metatype/testfile.xml
+++ b/bundles/org.eclipse.equinox.compendium.tests/bundles_src/metatype/tb3/OSGI-INF/metatype/testfile.xml
@@ -8,7 +8,13 @@
<AD cardinality="0" id="password2" type="Password"/>
<AD cardinality="0" default="Hello\, world!" id="string1" type="String"/>
</OCD>
+ <OCD id="ocd2" name="" description="">
+ <AD id="ad1" name="" description="" type="String"/>
+ </OCD>
<Designate pid="org.eclipse.equinox.metatype.tests.tb3">
<Object ocdref="ocd1"/>
</Designate>
+ <Designate pid="ocd2">
+ <Object ocdref="ocd2"/>
+ </Designate>
</md:MetaData>
diff --git a/bundles/org.eclipse.equinox.compendium.tests/src/org/eclipse/equinox/metatype/tests/BugTests.java b/bundles/org.eclipse.equinox.compendium.tests/src/org/eclipse/equinox/metatype/tests/BugTests.java
index 35fa5887d..ea5185765 100644
--- a/bundles/org.eclipse.equinox.compendium.tests/src/org/eclipse/equinox/metatype/tests/BugTests.java
+++ b/bundles/org.eclipse.equinox.compendium.tests/src/org/eclipse/equinox/metatype/tests/BugTests.java
@@ -50,6 +50,26 @@ public class BugTests extends AbstractTest {
assertValidationPass(escape(getFirstDefaultValue(ad.getDefaultValue())), ad);
}
+ /*
+ * StringIndexOutOfBoundsException when description or name attributes are an empty string
+ */
+ public void test341963() {
+ MetaTypeInformation mti = metatype.getMetaTypeInformation(bundle);
+ assertNotNull("Metatype information not found", mti); //$NON-NLS-1$
+ ObjectClassDefinition ocd = mti.getObjectClassDefinition("ocd2", null); //$NON-NLS-1$
+ assertNotNull("Object class definition not found", ocd); //$NON-NLS-1$
+ assertEquals("Wrong name", "", ocd.getName()); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("Wrong description", "", ocd.getDescription()); //$NON-NLS-1$ //$NON-NLS-2$
+ AttributeDefinition[] ads = ocd.getAttributeDefinitions(ObjectClassDefinition.ALL);
+ assertNotNull("Attribute definitions not found", ads); //$NON-NLS-1$
+ assertEquals("Wrong number of attribute definitions", 1, ads.length); //$NON-NLS-1$
+
+ AttributeDefinition ad = findAttributeDefinitionById("ad1", ads); //$NON-NLS-1$
+ assertNotNull("Attribute definition not found", ad); //$NON-NLS-1$
+ assertEquals("Wrong name", "", ad.getName()); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("Wrong description", "", ad.getDescription()); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
protected void setUp() throws Exception {
super.setUp();
bundle = bundleInstaller.installBundle("tb3"); //$NON-NLS-1$

Back to the top