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

Bug 325330

Summary: [Tree] NPE with NO_SCROLL style bit
Product: [RT] RAP Reporter: Benjamin Muskalla <b.muskalla>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: tbuschto
Version: 1.4   
Target Milestone: 1.4 M2   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 320597    

Description Benjamin Muskalla CLA 2010-09-15 06:33:39 EDT
Using a Tree with the SWT.NO_SCROLL style bit leads to an NPE on resize and when adding new treeitems as the scrollbar is null.

Snippet:
		Display display = new Display();
		Shell shell = new Shell(display);

		Tree tree = new Tree(shell, SWT.NO_SCROLL);
		TreeItem treeItem= new TreeItem(tree, SWT.NONE);
		treeItem.setText(0, "foo");
		
		shell.pack();
		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
		display.dispose();
		
		
Stacktrace:
java.lang.NullPointerException
	at org.eclipse.swt.widgets.Tree.updateScrollBars(Tree.java:2217)
	at org.eclipse.swt.widgets.TreeItem.<init>(TreeItem.java:289)
	at org.eclipse.swt.widgets.TreeItem.<init>(TreeItem.java:131)
	at bug.App.start(App.java:20)
	at org.eclipse.rap.ui.internal.application.EntrypointApplicationWrapper.createUI(EntrypointApplicationWrapper.java:27)
	at org.eclipse.rwt.internal.lifecycle.EntryPointManager.createUI(EntryPointManager.java:92)
	at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle.createUI(RWTLifeCycle.java:245)
	at org.eclipse.rwt.internal.lifecycle.RWTLifeCycle$UIThreadController.run(RWTLifeCycle.java:114)
	at java.lang.Thread.run(Thread.java:619)
	at org.eclipse.rwt.internal.lifecycle.UIThread.run(UIThread.java:102)
Comment 1 Ivan Furnadjiev CLA 2010-09-15 07:00:14 EDT
Added a check for SWT.NO_SCROLL in Tree#updateScrollBars().