Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 338569 - Not found problem with customized settings makes Codan Preference UI unusable
Summary: Not found problem with customized settings makes Codan Preference UI unusable
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-codan (show other bugs)
Version: 8.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 8.0   Edit
Assignee: Sergey Prigogin CLA
QA Contact: Elena Laskavaia CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-01 13:20 EST by Alex Ruiz CLA
Modified: 2012-05-22 14:57 EDT (History)
3 users (show)

See Also:


Attachments
Proposed patch (1.15 KB, patch)
2011-03-01 13:21 EST, Alex Ruiz CLA
eclipse.sprigogin: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Ruiz CLA 2011-03-01 13:20:26 EST
Build Identifier: 20110204-0611

Let's say I have my own custom codan checker installed in X instance of Eclipse+CDT. I make configuration changes to the problems provided by that checker (e.g. I configure them to "run in editor" only.) Now I open the same workspace with Y instance of Eclipse+CDT that does not have my custom codan checker and I go to the codan preference UI. I will get error "The currently displayed page contains invalid values" and I won't be able to see any configuration settings for the checkers that do exist in this instance of Eclipse.

I got the following stack trace in the console:
org.eclipse.core.runtime.AssertionFailedException: null argument:
	at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:85)
	at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:73)
	at org.eclipse.jface.viewers.StructuredSelection.<init>(StructuredSelection.java:74)
	at org.eclipse.cdt.codan.internal.ui.preferences.CodanPreferencePage.restoreWidgetValues(CodanPreferencePage.java:189)

The problem is that CodanPreferencePage does not check in "restoreWidgetValues" if the found problem is null, before passing it to the StructuredSelection constructor.

The fix is easy, just check for null before creating the StructuredSelection. Everything works fine after that. 

I'm attaching a patch.

Reproducible: Always

Steps to Reproduce:
1. Create a C/C++ project and change settings for a problem in the Codan Preference UI
2. Close Eclipse.
3. Remove the problem that was configured before from plugin.xml in the project 'org.eclipse.cdt.codan.checkers'
4. Restart Eclipse, opening same workspace as in #1
5. Go to the codan preference UI
6. Boom! Error!
Comment 1 Alex Ruiz CLA 2011-03-01 13:21:13 EST
Created attachment 190068 [details]
Proposed patch

Proposed solution.
Comment 2 Sergey Prigogin CLA 2011-03-04 18:16:00 EST
Fixed in HEAD > 20110304.
Comment 3 CDT Genie CLA 2011-03-04 18:23:10 EST
*** cdt cvs genie on behalf of sprigogin ***
Bug 338569 - Not found problem with customized settings makes Codan Preference UI unusable. Patch by Alex Ruiz.

[*] CodanPreferencePage.java 1.28 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/codan/org.eclipse.cdt.codan.ui/src/org/eclipse/cdt/codan/internal/ui/preferences/CodanPreferencePage.java?root=Tools_Project&r1=1.27&r2=1.28