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

Bug 333839

Summary: NPE opening Rename refactoring dialog
Product: [Tools] CDT Reporter: Marc-André Laperle <malaperle>
Component: cdt-refactoringAssignee: Sergey Prigogin <eclipse.sprigogin>
Status: VERIFIED FIXED QA Contact: Emanuel Graf <emanuel>
Severity: normal    
Priority: P3 CC: cdtdoug, eclipse.sprigogin, yevshif
Version: 8.0   
Target Milestone: 8.0.2   
Hardware: All   
OS: All   
Whiteboard:

Description Marc-André Laperle CLA 2011-01-10 02:44:46 EST
Using 8.0.0.201101100002 (hudson)

int main() {
  foo(); //note that foo is not declared!
  return 0;
}

1. Initiate Rename refactoring on foo (alt+shift+r)
2. Click on the arrow to reveal menu.
3. Select Open Rename Dialog
4. NPE occurs:

java.lang.NullPointerException
	at org.eclipse.cdt.internal.ui.refactoring.rename.CRenameProcessor.getSaveMode(CRenameProcessor.java:305)
	at org.eclipse.cdt.internal.ui.refactoring.rename.CRefactory.openDialog(CRefactory.java:136)
	at org.eclipse.cdt.internal.ui.refactoring.rename.RenameSupport.openDialog(RenameSupport.java:119)
	at org.eclipse.cdt.internal.ui.refactoring.rename.RenameSupport.openDialog(RenameSupport.java:90)
	at org.eclipse.cdt.internal.ui.refactoring.rename.RenameLinkedMode.startFullDialog(RenameLinkedMode.java:455)
	at org.eclipse.cdt.internal.ui.refactoring.rename.RenameInformationPopup$7$3.run(RenameInformationPopup.java:757)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
Comment 1 Marc-André Laperle CLA 2011-10-17 21:54:47 EDT
Fixed in 8.0.2 and master > 20111017.
Comment 2 CDT Genie CLA 2011-10-17 22:23:02 EDT
*** cdt git genie on behalf of Marc-Andre Laperle ***

    Bug 333839 - NPE opening Rename refactoring dialog

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=432fafe8b9a2e4ee3e74e956b758145da4e4fee9
Comment 3 CDT Genie CLA 2011-10-17 22:23:03 EDT
*** cdt git genie on behalf of Marc-Andre Laperle ***

    Bug 333839 - NPE opening Rename refactoring dialog

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=3d058369e67a456392f13797a4626c14e1193c5d
Comment 4 Sergey Prigogin CLA 2011-10-17 23:20:47 EDT
(In reply to comment #1)
The fix was invalid. I submitted a corrected one.
Comment 5 CDT Genie CLA 2011-10-17 23:23:01 EDT
*** cdt git genie on behalf of Sergey Prigogin ***

    Bug 333839 - NPE opening Rename refactoring dialog.

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=9452859ec8439d87021b698b81e97cc67238ff9c
Comment 6 CDT Genie CLA 2011-10-17 23:23:03 EDT
*** cdt git genie on behalf of Sergey Prigogin ***

    Bug 333839 - NPE opening Rename refactoring dialog.

[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=9bf03156220d0c490411afb7bee9658b4428e3a4
Comment 7 Marc-André Laperle CLA 2011-10-18 23:47:08 EDT
(In reply to comment #4)
> (In reply to comment #1)
> The fix was invalid. I submitted a corrected one.

Thanks you for correcting it. I see that it catches the error earlier, that's better. I think it would be great to show the error dialog as soon as Rename is invoked rather than after pressing enter or opening the Rename Dialog.
Comment 8 Sergey Prigogin CLA 2011-10-19 12:55:41 EDT
(In reply to comment #7)
> I think it would be great to show the error dialog as soon as Rename is
> invoked rather than after pressing enter or opening the Rename Dialog.

Agree. All is needed is a call to checkInitialConditions.
Comment 9 Marc-André Laperle CLA 2012-01-22 12:05:48 EST
Verified in 8.0.2 RC1.