Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 341963

Summary: [metatype] StringIndexOutOfBoundsException when description or name attributes are an empty string
Product: [Eclipse Project] Equinox Reporter: Jarek Gawor <jgawor>
Component: CompendiumAssignee: John Ross <jwross>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: tjwatson
Version: unspecified   
Target Milestone: 3.7 M7   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Patch for this issue.
tjwatson: iplog+
Test Patch tjwatson: iplog+

Description Jarek Gawor CLA 2011-04-05 16:38:27 EDT
Build Identifier: 

When description or name attributes in metatype.xml are set to an empty string calling getDescription() or getName() will cause the following exception:

java.lang.StringIndexOutOfBoundsException: String index out of range: 0
 	at java.lang.String.charAt(String.java:686)
 	at org.eclipse.equinox.metatype.LocalizationElement.getLocalized(LocalizationElement.java:38)
 	at org.eclipse.equinox.metatype.AttributeDefinitionImpl.getDescription(AttributeDefinitionImpl.java:117)


Reproducible: Always

Steps to Reproduce:
Create metatype.xml where name or description attributes are empty string. For example:

<AD id="present" description="" type="Boolean" default="true" />
Comment 1 Jarek Gawor CLA 2011-04-05 16:42:33 EDT
Created attachment 192599 [details]
Patch for this issue.
Comment 2 John Ross CLA 2011-04-05 18:08:29 EDT
Created attachment 192601 [details]
Test Patch

Original patch is fine. Here's a companion patch that adds a new test to compendium tests.
Comment 3 Thomas Watson CLA 2011-04-06 12:35:35 EDT
Comment on attachment 192599 [details]
Patch for this issue.

Thanks for the patch!  I released this to HEAD.
Comment 4 Thomas Watson CLA 2011-04-06 12:37:45 EDT
Comment on attachment 192601 [details]
Test Patch

Thanks for the patch.  I released it to HEAD.
Comment 5 Thomas Watson CLA 2011-04-06 12:38:08 EDT
.