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 106641 - NPE during refactoring redo.
Summary: NPE during refactoring redo.
Status: VERIFIED DUPLICATE of bug 106988
Alias: None
Product: xml
Classification: Unclassified
Component: Schema Tools (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P1 blocker (vote)
Assignee: Sonali Kochar
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-14 11:54 UTC by Michael Nazarov
Modified: 2007-09-07 17:42 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Nazarov 2007-06-14 11:54:31 UTC
Build 200706131200.

Steps to reproduce:

1. Create BluePrint1 sample and BpelModule.
2. Add reference from BluePrint1 to BpelModule.
3. Add sample Loan schema to BpelModule.
4. Import created schema to purchaseOrder.xsd file of BluePrint1.
5. Rename newLoadApplication file using Refactor -> Rename.
6. Undo rename using Refactor -> Undo [Rename].
7. Remove reference to newLoanApplication from purchaseOrder.
8. Add reference again.
9. Right click newLoanApplication and choose Refactor -> Redo [Rename]

java.lang.NullPointerException
	at org.netbeans.modules.xml.refactoring.spi.RefactoringUtil.isDirty(RefactoringUtil.java:161)
	at org.netbeans.modules.xml.refactoring.spi.RefactoringUtil.getDirtyModels(RefactoringUtil.java:297)
	at org.netbeans.modules.xml.refactoring.XMLRefactoringTransaction.process(XMLRefactoringTransaction.java:151)
	at org.netbeans.modules.xml.refactoring.XMLRefactoringTransaction.commit(XMLRefactoringTransaction.java:87)
	at org.netbeans.modules.refactoring.api.RefactoringSession.doRefactoring(RefactoringSession.java:91)
	at org.netbeans.modules.refactoring.spi.impl.UndoManager$SessionUndoItem.redo(UndoManager.java:512)
	at org.netbeans.modules.refactoring.spi.impl.UndoManager.redo(UndoManager.java:210)
	at org.netbeans.modules.refactoring.spi.impl.RedoAction.performAction(RedoAction.java:74)
	at org.openide.util.actions.CallableSystemAction$1.run(CallableSystemAction.java:96)
	at org.netbeans.modules.openide.util.ActionsBridge$ActionRunnable.actionPerformed(ActionsBridge.java:89)
	at org.netbeans.core.ModuleActions.invokeAction(ModuleActions.java:82)
	at org.netbeans.modules.openide.actions.ActionsBridgeImpl.invokeAction(ActionsBridgeImpl.java:30)
	at org.netbeans.modules.openide.util.ActionsBridge$ActionRunnable.doRun(ActionsBridge.java:80)
	at org.netbeans.modules.openide.util.ActionsBridge$1.run(ActionsBridge.java:49)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:539)
[catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:964)
Comment 1 Sonali Kochar 2007-06-15 01:36:53 UTC
When one does Refactor -> Rename, the core refactoring framework will find all "usages" of the object being renamed and
keeps it in a RefactoringElementsBag. Now, when you do undo/Redo, the refactoring framework doesnt find new usages, but
works with the ones in RefactoringElementsBag.

When in step(7) you remove reference from newLoanApplication from purchase order and again add the reference, this is
treated as a new usage even though its referring to the same file. The way schema is designed it deletes the old
reference obj and creates a new reference object. This new usage is not in the RefactoringElementsBag and the
refactoring framework is not aware of it. It still has old usage found in Step(5) and hence the NPE. I'll change the
code to check for NPE. With this fix, the NPE will go away BUT undo/redo will still not refactor the new reference.  

Ideally, undo/redo should be deactivated once you make changes or save files that are participating in a refactoring.
Will investigate on how to do this.
Comment 2 Sonali Kochar 2007-06-15 18:36:26 UTC
Fixed the NPE.. Still working on how to deactivate undo/redo when models change due to user actions.
Comment 3 Sonali Kochar 2007-06-19 17:41:54 UTC

*** This issue has been marked as a duplicate of 106988 ***
Comment 4 Michael Nazarov 2007-09-07 17:42:58 UTC
Redo disabled.