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

Bug 38729

Summary: [Preferences] NPE PreferencePage isValid
Product: [Eclipse Project] Platform Reporter: Sebastian Davids <sdavids>
Component: UIAssignee: Tod Creasey <Tod_Creasey>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: debbie_wilson
Version: 2.1   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 38692    
Attachments:
Description Flags
fix none

Description Sebastian Davids CLA 2003-06-10 15:37:34 EDT
getContainer may return null
Comment 1 Sebastian Davids CLA 2003-06-10 15:39:05 EDT
Created attachment 5142 [details]
fix
Comment 2 Felipe Heidrich CLA 2003-06-12 11:51:23 EDT
Move this up to the UI Team.
Comment 3 Debbie Wilson CLA 2003-06-12 13:44:27 EDT
Sebastian,
How did you get this NPE?  Can it be reproduced?  Which build were you using?  
What was contained in the .log file when this crash happened?
Comment 4 Sebastian Davids CLA 2003-06-12 15:15:58 EDT
I was working on bug 38692.

I checked out yesterdays org.eclipse.jdt.ui and used the binary plugins of M1 -
Version: 2.1.0 Build id: 200306051737

I embedded the JavadocPreferencePage a dialog.

At that time I could reproduce the NPE.

Unfortunately I cannot reproduce it anymore.

The NPE would always appear the first time the dialog was shown.

@@@@

This code fragement will produce the NPE:

Dialog dialog=new Dialog(shell) {
	protected Control createDialogArea(Composite parent) {
		Composite composite= (Composite) super.createDialogArea(parent);
		PreferencePage page = new PreferencePage() {
			protected Control createContents(Composite parent) {
				new Label(parent, SWT.NONE).setText("Test");
				return parent;
			}
		};
		page.createControl(composite);
		page.setValid(false); //<<<--------
		return composite;
	}
	
};
dialog.open();
Comment 5 Tod Creasey CLA 2003-06-13 11:04:22 EDT
Fix applied in build >20030613 - this is consistent with all other callers of 
getContainer.
Comment 6 Sebastian Davids CLA 2003-06-20 07:02:31 EDT
verified