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 119047 - Move refactoring causes NPE - checkCharsetConversion
Summary: Move refactoring causes NPE - checkCharsetConversion
Status: VERIFIED FIXED
Alias: None
Product: xml
Classification: Unclassified
Component: Schema Tools (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker (vote)
Assignee: Sonali Kochar
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-16 14:27 UTC by Mikhail Matveev
Modified: 2007-10-22 19:26 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Exception in ide when try to delete project (4.96 KB, application/octet-stream)
2007-10-16 17:50 UTC, tonybeckham
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mikhail Matveev 2007-10-16 14:27:14 UTC
1. Create some schema.
2. DnD it to other destination.
3. Press Refactor.
Same for other ways of doing move refactoring (Refactor -> Move... in main menu, Cut/Paste)
Result: exception comes.
This is a regression.

java.lang.NullPointerException
	at org.netbeans.modules.xml.schema.SchemaEditorSupport.checkCharsetConversion(SchemaEditorSupport.java:553)
	at org.netbeans.modules.xml.schema.SchemaEditorSupport.saveDocument(SchemaEditorSupport.java:477)
	at org.netbeans.modules.xml.schema.SchemaDataObject$1.save(SchemaDataObject.java:209)
	at org.netbeans.core.NbTopManager.saveAll(NbTopManager.java:283)
	at org.netbeans.core.NbTopManager.access$300(NbTopManager.java:90)
	at org.netbeans.core.NbTopManager$NbLifecycleManager.saveAll(NbTopManager.java:440)
	at org.netbeans.modules.refactoring.spi.impl.RefactoringPanel.refresh(RefactoringPanel.java:597)
	at org.netbeans.modules.refactoring.spi.impl.RefactoringPanel.<init>(RefactoringPanel.java:139)
	at org.netbeans.modules.refactoring.spi.impl.RefactoringPanel.<init>(RefactoringPanel.java:131)
	at org.netbeans.modules.refactoring.spi.ui.UI.openRefactoringUI(UI.java:72)
	at org.netbeans.modules.xml.refactoring.XMLRefactoringActionsProvider.doMove(XMLRefactoringActionsProvider.java:242)
	at org.netbeans.modules.refactoring.api.impl.ActionsImplementationFactory.doMove(ActionsImplementationFactory.java:113)
	at org.netbeans.modules.refactoring.spi.impl.MoveAction.performAction(MoveAction.java:62)
	at
org.netbeans.modules.refactoring.spi.impl.RefactoringGlobalAction$ContextAction.actionPerformed(RefactoringGlobalAction.java:177)
[catch] at
org.netbeans.modules.refactoring.impl.ClipboardConvertor$RefactoringPaste$RefactoringPasteType$1.run(ClipboardConvertor.java:140)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Comment 1 tonybeckham 2007-10-16 17:49:36 UTC
Product Version: NetBeans IDE 6.0 Beta 2 (Build 200710160000)
Java: 1.5.0_07; Java HotSpot(TM) Client VM 1.5.0_07-87
System: Mac OS X version 10.4.10 running on i386; MacRoman; en_US (nb)

For the same build but on Linux w/ Java 1.6.0_03 this is what happens for me.

1. The first move refactor does not throw any exceptions
2. The schema is moved but then it is immediately recreated at the same location that it was moved from thus there are 2
identical schemas.
3. Moving either of the two will throw the exception(in the log file, not in the IDE).  You can delete one of them but
exception still comes.
4. Trying to close the project brings up the save changes dialog but it is empty and you can discard or save it doesn't
matter
5. Trying to delete the project via the context menu in the ide throws exception in the ide that is almost the same as
the one in the log file,only a little bit longer. (see attachment).
Comment 2 tonybeckham 2007-10-16 17:50:55 UTC
Created attachment 51047 [details]
Exception in ide when try to delete project
Comment 3 Sonali Kochar 2007-10-17 15:45:25 UTC
The fix is in trunk.

Checking in XMLRefactoringTransaction.java;
/cvs/xml/refactoring/src/org/netbeans/modules/xml/refactoring/XMLRefactoringTransaction.java,v  <-- 
XMLRefactoringTransaction.java
new revision: 1.19; previous revision: 1.18
done
Checking in spi/RefactoringUtil.java;
/cvs/xml/refactoring/src/org/netbeans/modules/xml/refactoring/spi/RefactoringUtil.java,v  <--  RefactoringUtil.java
new revision: 1.8; previous revision: 1.7
done


Once the QE verifies the fix, I will request for integration with beta2 branch
Comment 4 Sonali Kochar 2007-10-17 16:34:46 UTC
The bug was in our save method. In the save method, we were setting the usage models to dirty. AS a result, in case of
move refactoring, the code was trying to save a file that has already moved, hence the NPE. Changed code to use
BackupFacility for undo/redo and removed save. The core refactoring framework saves all the changes after
refactoring/undo. We don't need to save the refactored files, the framework will take care of it.
Comment 5 tonybeckham 2007-10-17 16:59:19 UTC
Product Version: NetBeans IDE Dev (Build 20071017142729)
Java: 1.5.0_07; Java HotSpot(TM) Client VM 1.5.0_07-87
System: Mac OS X version 10.4.10 running on i386; MacRoman; en_US (nb)

Fix Verified in trunk on Mac OS.
Comment 6 Mikhail Matveev 2007-10-17 17:06:17 UTC
Fix verified in trunk on WinXP as well.
Comment 7 Sonali Kochar 2007-10-17 18:30:47 UTC
Fix integrated into release60_beta2 branch
Comment 8 tonybeckham 2007-10-22 19:26:43 UTC
Fix Verified:

Product Version: NetBeans IDE 6.0 Beta 2 (Build 200710212201)
Java: 1.5.0_07; Java HotSpot(TM) Client VM 1.5.0_07-87
System: Mac OS X version 10.4.10 running on i386; MacRoman; en_US (nb)

and in trunk on XP as desc7 states.