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

Bug 252354

Summary: HTTP 500 while double clicking Link control (Firefox, Chrome)
Product: [RT] RAP Reporter: Andre Weber <andre.weber>
Component: RWTAssignee: Ralf Sternberg <rsternberg>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 1.1   
Target Milestone: 1.2 M3   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 257595    

Description Andre Weber CLA 2008-10-28 09:30:22 EDT
Consider a Link control with a registered SelectionListener.

Within the widgetSelected(SelectionEvent) method, change the text of the Link control where the selection listener applies to:

...
public void widgetSelected(SelectionEvent arg0)
{
  link.setText("Lorem ipsum dolor sit amet"); // without any <a>
}
...

In our case, the new text now doesn't contain an anchor tag (<a>) and therefore is not longer a real link.

Now, double clicking on that link results in an HTTP 500 error with the following stack trace:

java.lang.ArrayIndexOutOfBoundsException: 0
org.eclipse.swt.internal.widgets.linkkit.LinkLCA.getIdText(LinkLCA.java:126)
org.eclipse.swt.internal.widgets.linkkit.LinkLCA.readData(LinkLCA.java:65)
org.eclipse.swt.internal.widgets.displaykit.DisplayLCA$1.doVisit(DisplayLCA.java:259)
org.eclipse.swt.internal.widgets.WidgetTreeVisitor$AllWidgetTreeVisitor.visit(WidgetTreeVisitor.java:28)
org.eclipse.swt.internal.widgets.WidgetTreeVisitor.accept(WidgetTreeVisitor.java:59)
org.eclipse.swt.internal.widgets.WidgetTreeVisitor.accept(WidgetTreeVisitor.java:51)
org.eclipse.swt.internal.widgets.WidgetTreeVisitor.accept(WidgetTreeVisitor.java:51)
org.eclipse.swt.internal.widgets.WidgetTreeVisitor.accept(WidgetTreeVisitor.java:51)
org.eclipse.swt.internal.widgets.displaykit.DisplayLCA.readData(DisplayLCA.java:266)
org.eclipse.rwt.internal.lifecycle.ReadData.execute(ReadData.java:26)
org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.continueLifeCycle(RWTLifeCycle.java:208)
org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.sleep(RWTLifeCycle.java:305)
org.eclipse.swt.widgets.Display.sleep(Display.java:703)
<ourEntryPoint>.createUI(...)
org.eclipse.rwt.internal.lifecycle.EntryPointManager.createUI(EntryPointManager.java:92)
org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.createUI(RWTLifeCycle.java:230)
org.eclipse.rwt.internal.lifecycle.RWTLifeCycle$UIThreadController.run(RWTLifeCycle.java:116)
java.lang.Thread.run(Thread.java:595)

We encountered the error using Firefox 2.0 and Google Chrome.

Internet Explorer 6 and 7 works fine.

Kind regards
Andre Weber
Comment 1 Ralf Sternberg CLA 2008-10-29 05:43:40 EDT
Due to the modification of the number of anchors in the selection listener, the second event refers to a non-existing anchor in this scenario.
The fix was to guard the array access.

An interesting observation is that it does not happen in IE. FF issues two selection events for a double click, IE only one. Opened bug 252559 for this issue.
Comment 2 Ralf Sternberg CLA 2008-12-15 05:56:36 EST
Also fixed in SR 1.1.2.