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 149654

Summary: RuntimeException at org.netbeans.modules.refactoring.java.plugins.RetoucheCommit.rollback
Product: guibuilder Reporter: Jiri Prox <jiriprox>
Component: CodeAssignee: issues@guibuilder <issues>
Status: NEW ---    
Severity: blocker CC: aldobrucale, asenk, ca-nb, dbcurtis, devon_c_miller, diefer, ggghhhjjj, javydreamercsw, jbecicka, joshis, jpokorsky, sunbiz, ttokoly
Priority: P3    
Version: 7.0   
Hardware: All   
OS: All   
URL: http://statistics.netbeans.org/exceptions/detail.do?id=125648
Issue Type: DEFECT Exception Reporter: 125648
Attachments: stacktrace
stacktrace
stacktrace
stacktrace
stacktrace
stacktrace
stacktrace
stacktrace
stacktrace
stacktrace

Description Jiri Prox 2008-10-09 16:39:58 UTC
Build: NetBeans IDE Dev (Build 20081009092807)
VM: Java HotSpot(TM) Client VM, 11.0-b15, Java(TM) SE Runtime Environment, 1.6.0_10-rc2-b32
OS: Windows Vista, 6.0, x86

User Comments:
jiriprox: RE whem undoing change parameters refactoring



Stacktrace: 
java.lang.RuntimeException
        at org.netbeans.modules.refactoring.java.plugins.RetoucheCommit.rollback(RetoucheCommit.java:100)
        at org.netbeans.modules.refactoring.api.RefactoringSession.undoRefactoring(RefactoringSession.java:163)
        at org.netbeans.modules.refactoring.spi.impl.UndoManager$SessionUndoItem.undo(UndoManager.java:596)
        at org.netbeans.modules.refactoring.spi.impl.UndoManager.undo(UndoManager.java:221)
        at org.netbeans.modules.refactoring.spi.impl.UndoAction.performAction(UndoAction.java:96)
        at org.openide.util.actions.CallableSystemAction$1.run(CallableSystemAction.java:118)
Comment 1 Jiri Prox 2008-10-09 16:40:06 UTC
Created attachment 71477 [details]
stacktrace
Comment 2 Jan Pokorsky 2008-10-13 18:46:58 UTC
Could you attach a test class for verifying purposes?
Comment 3 sunbiz 2008-10-28 11:25:33 UTC
Build: NetBeans IDE Dev (Build 200810240201)
VM: Java HotSpot(TM) Client VM, 11.0-b15, Java(TM) SE Runtime Environment, 1.6.0_10-rc2-b32
OS: Windows Vista, 6.0, x86

User Comments: 
Refactor-> Undo Rename on a method inside gaurded block

Stacktrace: 
java.lang.RuntimeException
        at org.netbeans.modules.refactoring.java.plugins.RetoucheCommit.rollback(RetoucheCommit.java:100)
        at org.netbeans.modules.refactoring.api.RefactoringSession.undoRefactoring(RefactoringSession.java:163)
        at org.netbeans.modules.refactoring.spi.impl.UndoManager$SessionUndoItem.undo(UndoManager.java:596)
        at org.netbeans.modules.refactoring.spi.impl.UndoManager.undo(UndoManager.java:221)
        at org.netbeans.modules.refactoring.spi.impl.UndoAction.performAction(UndoAction.java:96)
        at org.openide.util.actions.CallableSystemAction$.run(CallableSystemAction.java:118)
Comment 4 sunbiz 2008-10-28 11:25:42 UTC
Created attachment 72756 [details]
stacktrace
Comment 5 Andrei Chistiakov 2009-05-14 16:23:42 UTC
Build: NetBeans IDE Dev (Build 200905100201)
VM: Java HotSpot(TM) Client VM, 11.3-b02, Java(TM) SE Runtime Environment, 1.6.0_13-b02
OS: Windows XP, 5.1, x86

User Comments: 
To reproduce:
- create Mobile Application with Hello MIDlet;
- in Flow, select form and invoke Rename popup menu command;
- set a new name, perform refactoring;
- in Projects tree, select HelloMIDlet.java and invoke 'Refactor|Undo'.


Stacktrace: 
org.openide.util.RequestProcessor$Item: task failed: java.lang.RuntimeException
        at org.openide.util.RequestProcessor$Item.fillInStackTrace(RequestProcessor.java:853)
        at java.lang.Throwable.<init>(Throwable.java:181)
        at java.lang.Exception.<init>(Exception.java:29)
        at org.openide.util.RequestProcessor$Item.<init>(RequestProcessor.java:819)
        at org.openide.util.RequestProcessor$Task.schedule(RequestProcessor.java:629)
        at org.openide.util.RequestProcessor.post(RequestProcessor.java:295)
Comment 6 Andrei Chistiakov 2009-05-14 16:23:52 UTC
Created attachment 82137 [details]
stacktrace
Comment 7 Petr Dvorak 2009-08-19 17:45:09 UTC
Build: NetBeans IDE Dev (Build 200908171401)
VM: Java HotSpot(TM) Client VM, 14.0-b16, Java(TM) SE Runtime Environment, 1.6.0_14-b08
OS: Linux, 2.6.28-11-generic, i386

User Comments: 
I have created a class extending a JPanel. Then I added a JList in a designer "jList1". I switched to editor and wrote some code that use this variable name.

Then I invoked Ctrl+R above this variable to rename it. I renamed the variable, but it was not successful (guarded code was not updated), so I invoked Refactor>Undo

Stacktrace: 
java.lang.Throwable: Locked by:
        at org.openide.filesystems.FileLock.<init>(FileLock.java:80)
        at org.netbeans.modules.masterfs.filebasedfs.fileobjects.LockForFile.<init>(LockForFile.java:89)
        at org.netbeans.modules.masterfs.filebasedfs.fileobjects.LockForFile.tryLock(LockForFile.java:100)
        at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObj.lock(FileObj.java:313)
        at org.openide.loaders.MultiDataObject$Entry.takeLock(MultiDataObject.java:1189)
        at org.netbeans.modules.form.FormEditorSupport$Environment.takeLock(FormEditorSupport.java:1369)
Comment 8 Petr Dvorak 2009-08-19 17:45:21 UTC
Created attachment 86479 [details]
stacktrace
Comment 9 Exceptions Reporter 2009-08-19 17:45:27 UTC
This issue already has 5 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=125648
Comment 10 Jan Pokorsky 2009-08-20 13:05:57 UTC
Thank you for the reproducible test case with form file. I will investigate.
Comment 11 Jan Pokorsky 2009-08-20 14:15:23 UTC
It seems to be a problem in the form editor support that does not release the file lock. If you choose the Save Document
action manually then changes propagate as expected. In case of plain java file the rename works. Reassigning.
Comment 12 aldobrucale 2009-09-17 14:49:04 UTC
Build: NetBeans IDE Dev (Build nbms-and-javadoc-3940-on-090917)
VM: Java HotSpot(TM) Client VM, 14.2-b01, Java(TM) SE Runtime Environment, 1.6.0_16-b01
OS: Linux, 2.6.28-15-generic, i386

User Comments: 
undo rename

Stacktrace: 
java.lang.Throwable: Locked by:
        at org.openide.filesystems.FileLock.<init>(FileLock.java:80)
        at org.netbeans.modules.masterfs.filebasedfs.fileobjects.LockForFile.<init>(LockForFile.java:89)
        at org.netbeans.modules.masterfs.filebasedfs.fileobjects.LockForFile.tryLock(LockForFile.java:100)
        at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObj.lock(FileObj.java:313)
        at org.openide.loaders.MultiDataObject$Entry.takeLock(MultiDataObject.java:1189)
        at org.netbeans.modules.form.FormEditorSupport$Environment.takeLock(FormEditorSupport.java:1370)
Comment 13 aldobrucale 2009-09-17 14:49:08 UTC
Created attachment 87862 [details]
stacktrace
Comment 14 Exceptions Reporter 2009-09-17 14:49:14 UTC
This issue already has 6 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=125648
Comment 15 Exceptions Reporter 2009-12-04 08:39:58 UTC
Created attachment 92120 [details]
stacktrace

Rename de uma classe
Comment 16 Jan Becicka 2010-01-27 04:59:43 UTC
Created attachment 93586 [details]
stacktrace

I tried to rename field, which declaration is in guarded block. There is no warning, that I cannot do that and refactoring is done only in non-guarded sections (breaking the code). Both Undo (editor and refactoring) did not work for me.
Comment 17 asenk 2011-04-19 10:34:04 UTC
Created attachment 107832 [details]
stacktrace

1. Create new project: main menu File | New Project... | Java, Java Application | Next (leave all default) | Finish
2. Create new JFrame in main package (by default javaapplication1): invoke popup menu on package node in Projects view | New | JFrame Form... (leave all by default) | Finish
3. NewJFrame.java should be created and Design button pushed (main menu View | Editors | Design). From Palette window | Swing Controls grab Button and drop it somwhere inside the NewJFrame.
4. Push the Source button (main menu View | Editors | Source)
5. Copy and paste this code:

    public void foo(){
        JButton jButton1= new JButton();
        JButton jButton2= jButton1;
    }
    
    public void foo2(){
        String neco=this.jButton1.getText();
    }

somewhere to NewJFrame class (e.g. below constructor).

6. Invoke Refactor | Rename from popup menu on jButton1 in method foo2.
7. Enter new name (e.g. tlacitkooo). Preview the changes and perform Refactor.
8. Call main menu Refactor | Undo.
Comment 18 ttokoly 2011-04-19 10:37:04 UTC
Created attachment 107833 [details]
stacktrace

Product Version: NetBeans IDE Dev (Build 201104180401)
Java: 1.6.0_25; Java HotSpot(TM) Client VM 20.0-b11
System: Linux version 2.6.32-30-generic running on i386; UTF-8; en_US (nb)

1. Create new project: main menu File | New Project... | Java, Java Application | Next (leave all default) | Finish
2. Create new JFrame in main package (by default javaapplication1): invoke popup menu on package node in Projects view | New | JFrame Form... (leave all by default) | Finish
3. NewJFrame.java should be created and Design button pushed (main menu View | Editors | Design). From Palette window | Swing Controls grab Button and drop it somwhere inside the NewJFrame.
4. Push the Source button (main menu View | Editors | Source)
5. Copy and paste this code:

    public void foo(){
        JButton jButton1= new JButton();
        JButton jButton2= jButton1;
    }
    
    public void foo2(){
        String neco=this.jButton1.getText();
    }

somewhere to NewJFrame class (e.g. below constructor).

6.
Comment 19 javydreamercsw 2011-05-03 17:27:31 UTC
Created attachment 108082 [details]
stacktrace

Tried undo Encapsulate Fields.
Comment 20 javydreamercsw 2011-05-03 17:30:42 UTC
Updated to 7.0 as it was reproduced on that release.
Comment 21 Tomas Pavek 2012-08-29 14:58:41 UTC
There is no special refactoring undo action since 7.2, it's done by the Edit | Undo action. The problem is that the GUI builder resets the editor undo queue when generating code - which it does during refactoring. So undo of refactoring is currently not possible when a GUI form is involved.