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

Bug 325009

Summary: NPE when changing int or boolean preference for the first time
Product: z_Archived Reporter: Adam Taylor <awtaylor>
Component: IMPAssignee: Robert M. Fuhrer <rfuhrer>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
proposed implementation none

Description Adam Taylor CLA 2010-09-10 15:46:16 EDT
Build Identifier: 

NPE when changing int or boolean preference for the first time

Reproducible: Always

Steps to Reproduce:
1. Open an an Imp language resource (so that a UniversalEditor is opened).
2. Goto the associated language preferences
3. modify any integer or boolean preference and click ok

==> NPE in error log
Comment 1 Adam Taylor CLA 2010-09-10 15:48:14 EDT
Created attachment 178658 [details]
proposed implementation

this patch also disables the apply and ok buttons on the preferences page when a non-int string is entered into an integer field
Comment 2 Robert M. Fuhrer CLA 2010-11-19 17:33:00 EST
Theoretically this should never happen, since the preference initializer should ensure that there is a legal value for each preference key. However, it might happen if the preferences DB didn't get initialized properly, so I added null guards as requested.

I'm not sure why the call to notifyState() was added to StringFieldEditor.refreshValidState(), so I omitted that. If you can explain why it's needed, I'll reconsider.

Changes checked into SVN trunk.