Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 306378 - Error in StringToIntArray prevents using SashForm with single weight element
Summary: Error in StringToIntArray prevents using SashForm with single weight element
Status: RESOLVED FIXED
Alias: None
Product: XWT
Classification: Technology
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-18 10:55 EDT by Konstantin Scheglov CLA
Modified: 2013-01-24 15:32 EST (History)
1 user (show)

See Also:


Attachments
Fix for array with single element (1.66 KB, patch)
2010-03-18 11:00 EDT, Konstantin Scheglov CLA
no flags Details | Diff
Fix for array with single element, also throw exception (1.89 KB, patch)
2010-04-27 07:49 EDT, Konstantin Scheglov CLA
john.arthorne: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Konstantin Scheglov CLA 2010-03-18 10:55:54 EDT
Build Identifier: I20100218

This code fails.
---
<Shell xmlns="http://www.eclipse.org/xwt/presentation"
    xmlns:x="http://www.eclipse.org/xwt">
    <Shell.layout>
    	<FillLayout/>
    </Shell.layout>
    <SashForm weights="1">
		<Button text="Test"/>
	</SashForm>
</Shell>
---

...because StringToIntArray considers String with single element as empty array.
This is incorrect.

Reproducible: Always
Comment 1 Konstantin Scheglov CLA 2010-03-18 11:00:09 EDT
Created attachment 162417 [details]
Fix for array with single element

This fixes problem for me. It seems that StringTokenizer is smart on its own, so no additional checks required.

But still I'm not sure that e.printStackTrace(); is correct way for handling exceptions. XWT rendering may be part of some more complex system, so would be good to re-throw exception to allow higher level to know about problem.
Comment 2 Konstantin Scheglov CLA 2010-04-27 07:49:14 EDT
Created attachment 166181 [details]
Fix for array with single element, also throw exception
Comment 3 Yves YANG CLA 2010-05-22 12:10:34 EDT
Thanks the patch is applied for 1.0M6