Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 311881 - NPE in Link traversal code
Summary: NPE in Link traversal code
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.6 RC1   Edit
Assignee: Felipe Heidrich CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-06 09:50 EDT by Felipe Heidrich CLA
Modified: 2010-05-06 10:56 EDT (History)
1 user (show)

See Also:
Silenio_Quarti: review+


Attachments
patch (1.05 KB, patch)
2010-05-06 10:09 EDT, Felipe Heidrich CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Felipe Heidrich CLA 2010-05-06 09:50:54 EDT
Nightly Build: N20100505-2000 was broken (I suspect) by 
Bug 291749 - [Widgets] Links in Link widget not selectable via keyboard (no focus ring) 

The fix access the offset array without checking if it is null,
the array can be null when no text is set in the link.






java.lang.NullPointerException
at org.eclipse.swt.widgets.Link.traversalCode(Link.java:649)
at org.eclipse.swt.widgets.Control.isTabGroup(Control.java:2022)
at org.eclipse.swt.widgets.Control.computeTabGroup(Control.java:789)
at org.eclipse.swt.widgets.Control.traverseGroup(Control.java:4242)
at org.eclipse.swt.widgets.Control.traverse(Control.java:4225)
at org.eclipse.swt.widgets.Control.traverse(Control.java:4214)
at org.eclipse.swt.tests.junit.Test_org_eclipse_swt_widgets_Control.test_traverseI(Test_org_eclipse_swt_widgets_Control.java:681)
at org.eclipse.swt.tests.junit.Test_org_eclipse_swt_widgets_Control.runTest(Test_org_eclipse_swt_widgets_Control.java:855)
at org.eclipse.swt.tests.junit.Test_org_eclipse_swt_widgets_Link.runTest(Test_org_eclipse_swt_widgets_Link.java:183)
at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.java:376)
at org.eclipse.test.EclipseTestRunner.run(EclipseTestRunner.java:209)
at org.eclipse.test.CoreTestApplication.runTests(CoreTestApplication.java:35)
at org.eclipse.test.CoreTestApplication.run(CoreTestApplication.java:31)
at org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:587)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:198)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
at org.eclipse.core.launcher.Main.main(Main.java:34)
Comment 1 Felipe Heidrich CLA 2010-05-06 09:57:26 EDT
snippet:

public static void main (String[] args) {
	Display display = new Display();
	final Shell shell = new Shell(display);
	new Link(shell, SWT.NONE);
	shell.open();
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch())
			display.sleep();
	}
	display.dispose();
}

stack:
Exception in thread "main" java.lang.NullPointerException
	at org.eclipse.swt.widgets.Link.traversalCode(Link.java:649)
	at org.eclipse.swt.widgets.Control.isTabGroup(Control.java:2022)
	at org.eclipse.swt.widgets.Control.computeTabList(Control.java:794)
	at org.eclipse.swt.widgets.Composite.computeTabList(Composite.java:262)
	at org.eclipse.swt.widgets.Control.traverseGroup(Control.java:4243)
	at org.eclipse.swt.widgets.Shell.open(Shell.java:1174)
	at misc.prs.Main.main3353(Main.java:29)
	at misc.prs.Main.main(Main.java:19)
Comment 2 Felipe Heidrich CLA 2010-05-06 10:09:52 EDT
Created attachment 167309 [details]
patch
Comment 3 Felipe Heidrich CLA 2010-05-06 10:40:52 EDT
Fixed in HEAD > 20100506