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

Bug 317946

Summary: [StyledText]java.lang.IllegalArgumentException: Index out of bounds happen when StyledText setText("")
Product: [Eclipse Project] Platform Reporter: Sun Yuechen <yuechen.sun>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: eclipse.felipe, niraj.modi
Version: 4.0   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard:

Description Sun Yuechen CLA 2010-06-25 06:28:46 EDT
Build Identifier: org.eclipse.swt.win32.win32.x86_3.5.1.v3555a

When I invoke StyledText.setText(""), an Exception happens.
at org.eclipse.swt.SWT.error(SWT.java:3865)
[ 2010-06-07 11:41:21.187 11 ] 	at org.eclipse.swt.SWT.error(SWT.java:3799)
[ 2010-06-07 11:41:21.187 11 ] 	at org.eclipse.swt.SWT.error(SWT.java:3770)
[ 2010-06-07 11:41:21.187 11 ] 	at org.eclipse.swt.graphics.TextLayout.getStyle(TextLayout.java:2342)
[ 2010-06-07 11:41:21.187 11 ] 	at org.eclipse.swt.custom.StyledTextRenderer.getTextLayout(StyledTextRenderer.java:927)
[ 2010-06-07 11:41:21.187 11 ] 	at org.eclipse.swt.custom.StyledTextRenderer.getTextLayout(StyledTextRenderer.java:702)
[ 2010-06-07 11:41:21.187 11 ] 	at org.eclipse.swt.custom.StyledTextRenderer.calculate(StyledTextRenderer.java:202)
[ 2010-06-07 11:41:21.187 11 ] 	at org.eclipse.swt.custom.StyledTextRenderer.calculateClientArea(StyledTextRenderer.java:220)
[ 2010-06-07 11:41:21.187 11 ] 	at org.eclipse.swt.custom.StyledText.resetCache(StyledText.java:7245)
[ 2010-06-07 11:41:21.187 11 ] 	at org.eclipse.swt.custom.StyledText.reset(StyledText.java:7238)
[ 2010-06-07 11:41:21.187 11 ] 	at org.eclipse.swt.custom.StyledText.handleTextSet(StyledText.java:6157)
[ 2010-06-07 11:41:21.187 11 ] 	at org.eclipse.swt.custom.StyledText$6.textSet(StyledText.java:5524)
[ 2010-06-07 11:41:21.187 11 ] 	at org.eclipse.swt.custom.StyledTextListener.handleEvent(StyledTextListener.java:76)
[ 2010-06-07 11:41:21.187 11 ] 	at org.eclipse.swt.custom.DefaultContent.sendTextEvent(DefaultContent.java:795)
[ 2010-06-07 11:41:21.187 11 ] 	at org.eclipse.swt.custom.DefaultContent.setText(DefaultContent.java:814)
[ 2010-06-07 11:41:21.187 11 ] 	at org.eclipse.swt.custom.StyledText.setText(StyledText.java:9183)

Reproducible: Couldn't Reproduce
Comment 1 Felipe Heidrich CLA 2010-06-25 13:32:09 EDT
I need reproducible test case before I can work on this problem. Thank you.
Comment 2 Niraj Modi CLA 2017-07-06 08:36:09 EDT
Tried StyledText#setText("") with below snippet:
http://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet244.java

Cannot reproduce this problem, hence closing as 'WORKS_FOR_ME'
You can reopen this bug if it still happens with any of the current supported platforms with valid steps to reproduce this issue.