This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 210294

Summary: NullPointerException at org.openide.text.UndoRedoManager.editToBeUndoneRedone
Product: java Reporter: aldobrucale <aldobrucale>
Component: RefactoringAssignee: Jan Becicka <jbecicka>
Status: VERIFIED FIXED    
Severity: normal CC: MackSix, ttokoly
Priority: P2    
Version: 7.2   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter: 186410
Attachments: stacktrace
stacktrace
stacktrace
stacktrace
Analysis of the undo/redo performed during refactoring and its undo.

Description aldobrucale 2012-03-28 14:44:52 UTC
Build: NetBeans IDE Dev (Build 201203271056)
VM: Java HotSpot(TM) Client VM, 22.1-b02, Java(TM) SE Runtime Environment, 1.7.0_03-b04
OS: Linux

User Comments:
aldobrucale: I moved a method and an inner class from a class to another; the inner class did not move; I tried to undo all refactorings but the last dialog asked if I really wanted to undo "null"; I said yes and got NPE




Stacktrace: 
java.lang.NullPointerException
   at org.openide.text.UndoRedoManager.editToBeUndoneRedone(UndoRedoManager.java:569)
   at org.openide.text.NbDocument.getEditToBeUndoneRedoneOfType(NbDocument.java:572)
   at org.openide.text.NbDocument.getEditToBeUndoneOfType(NbDocument.java:559)
   at org.openide.text.NbDocument$APIAccessorImpl.getEditToBeUndoneOfType(NbDocument.java:548)
   at org.netbeans.modules.openide.text.NbDocumentRefactoringHack.getEditToBeUndoneOfType(NbDocumentRefactoringHack.java:73)
   at org.netbeans.modules.refactoring.spi.BackupFacility2$DefaultImpl.checkChecksum(BackupFacility2.java:256)
Comment 1 aldobrucale 2012-03-28 14:44:54 UTC
Created attachment 117414 [details]
stacktrace
Comment 2 ttokoly 2012-03-28 16:26:27 UTC
Created attachment 117424 [details]
stacktrace

1. Unzip a project default to some work directory - there is link:
http://wiki.netbeans.org/wiki/images/2/2d/Default_TS_60_Refactoring.zip
2. Start IDE with a clean userdir
3. Invoke File | Open Project... action
4. Select unzipped project default
5. Scanning structure of project should be performed (it takes a while)

6. Put caret on field protectedProperty of the org.netbeans.tests.examples.packb.BeanA class in the Project view and invoke Refactor | Rename action from the popup menu.
7. Fill a new field name protectedPropertyRenamed, check checkbox 'Rename Getters and Setters' and confirm this dialog.
There should be displayed a warning:
O There are methods in subclasses/implementors of BeanA that override or implement this method. They will also be renamed.
8. If you agree with these changes press Do Refactoring button and changes will be performed.
9. Pressed Undo action.
10. This error shows up.
Comment 3 ttokoly 2012-03-28 16:32:22 UTC
Created attachment 117425 [details]
stacktrace

Same as before: Undo action after renaming a field with getters and setters.
Comment 4 MackSix 2012-04-07 08:38:23 UTC
Created attachment 117968 [details]
stacktrace

Undo a moved JFrame form with Internationlization.
Comment 5 Miloslav Metelka 2012-04-11 14:48:57 UTC
I've reproduced the problem in a project attached by ttokoly according to given steps.
I've fixed the NPE but undo of the refactoring does not succeed although I did no extra modifications (see attached analysis) so reassigning to refactoring for further evaluation.

openide.text partial fix:
http://hg.netbeans.org/jet-main/rev/248f9b21ad44
Comment 6 Miloslav Metelka 2012-04-11 14:49:58 UTC
Created attachment 118141 [details]
Analysis of the undo/redo performed during refactoring and its undo.
Comment 7 Quality Engineering 2012-04-13 09:51:15 UTC
Integrated into 'main-golden', will be available in build *201204130400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/248f9b21ad44
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #210294 - NullPointerException at org.openide.text.UndoRedoManager.editToBeUndoneRedone - partial fix (in openide.text).
Comment 8 Jan Becicka 2012-04-13 14:19:53 UTC
Changeset: 582fe89d41b3
Author:    Jan Becicka <jbecicka@netbeans.org>
Date:      2012-04-13 16:16
Message:   
Issue #210294 - NullPointerException at org.openide.text.UndoRedoManager.editToBeUndoneRedone
Comment 9 Quality Engineering 2012-04-14 09:44:48 UTC
Integrated into 'main-golden', will be available in build *201204140400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/582fe89d41b3
User: Jan Becicka <jbecicka@netbeans.org>
Log: Issue #210294 - NullPointerException at org.openide.text.UndoRedoManager.editToBeUndoneRedone
Comment 10 ttokoly 2012-04-16 10:33:01 UTC
Product Version: NetBeans IDE 7.1.2 (Build 201204101705)
Java: 1.7.0_04; Java HotSpot(TM) Client VM 23.0-b21
System: Linux version 3.0.0-17-generic running on i386; UTF-8; en_US (nb)

Verified, works for me now. Thanks :) .