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 192480 - javax.swing.undo.CannotUndoException at org.netbeans.editor.BaseDocumentEvent.undo
Summary: javax.swing.undo.CannotUndoException at org.netbeans.editor.BaseDocumentEvent...
Status: RESOLVED WONTFIX
Alias: None
Product: editor
Classification: Unclassified
Component: Actions/Menu/Toolbar (show other bugs)
Version: 7.1
Hardware: All All
: P3 normal with 2 votes (vote)
Assignee: Miloslav Metelka
URL:
Keywords:
: 193502 197979 204407 216683 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-11-25 16:45 UTC by leopard2av
Modified: 2016-07-07 07:31 UTC (History)
11 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 174309


Attachments
stacktrace (2.08 KB, text/plain)
2010-11-25 16:45 UTC, leopard2av
Details
stacktrace (2.33 KB, text/plain)
2013-11-13 14:09 UTC, Vladimir Riha
Details
stacktrace (3.39 KB, text/plain)
2013-11-25 12:52 UTC, rodrigorsantos
Details
stacktrace (3.39 KB, text/plain)
2013-11-25 12:58 UTC, rodrigorsantos
Details

Note You need to log in before you can comment on or make changes to this bug.
Description leopard2av 2010-11-25 16:45:37 UTC
This bug was originally marked as duplicate of bug 171275, that is already resolved. This bug is still valid, so this seems to be another bug, but it might be related.

Build: NetBeans IDE 7.0 Beta (Build 201011152355)
VM: Java HotSpot(TM) 64-Bit Server VM, 17.1-b03, Java(TM) SE Runtime Environment, 1.6.0_22-b04
OS: Linux

User Comments:
leopard2av: Discard source modifications on close




Stacktrace: 
javax.swing.undo.CannotUndoException
   at org.netbeans.editor.BaseDocumentEvent.undo(BaseDocumentEvent.java:271)
   at org.netbeans.editor.GuardedDocumentEvent.undo(GuardedDocumentEvent.java:72)
   at javax.swing.undo.CompoundEdit.undo(CompoundEdit.java:46)
   at org.netbeans.editor.BaseDocument$AtomicCompoundEdit.undo(BaseDocument.java:2221)
   at org.netbeans.editor.BaseDocument.breakAtomicLock(BaseDocument.java:1872)
   at org.netbeans.editor.GuardedDocument.runAtomic(GuardedDocument.java:320)
Comment 1 leopard2av 2010-11-25 16:45:40 UTC
Created attachment 103334 [details]
stacktrace
Comment 2 David Strupl 2010-11-26 13:46:18 UTC
Milo, can you please check this one?
Comment 3 Miloslav Metelka 2010-11-29 10:33:07 UTC
leopard2av: Is there any way how to reproduce this e.g. a specific source file? Thanks.
Comment 4 David Strupl 2010-12-21 12:54:24 UTC
*** Bug 193502 has been marked as a duplicate of this bug. ***
Comment 5 Milutin Kristofic 2011-09-15 14:32:27 UTC
It looks it was fixed by http://netbeans.org/bugzilla/show_bug.cgi?id=183998.
Comment 6 Milutin Kristofic 2011-09-15 14:53:12 UTC
*** Bug 197979 has been marked as a duplicate of this bug. ***
Comment 7 Milutin Kristofic 2011-09-19 12:34:31 UTC
This is probably happing, because of race condition, which is really difficult to find without a concrete steps for reproduce. Please, reopen if you can find a way to reproduce this exception
Comment 8 dbell 2011-10-30 12:36:26 UTC
Reproduced this unreliably. I found that it happens after Bug 204285 and before Bug 204407. Here are the steps I used.

In a Maven Java project:
1) right-click a test package (com.demo.test) >New > Java Class
2) create class MyClass in this package
3) add the following method

package com.demo.test;

public class MyClass {
    public void doSomething() {
    }
}

4) right-click the same package > New > Java Class
5) create class MyService in this package
6) add the following method:

package com.demo.test;

import java.io.File;

public class MyService {
    public void go(File file) {
        
    }
}

7) Add a field to MyClass, and partially reference it:
package com.demo.test;

public class MyClass {
    private MyService service;
    
    public void doSomething() {
        service.go
    }
}

8) Drag MyClass to a different package (com.demo.otherpackage)
9) Exception thrown: http://statistics.netbeans.org/analytics/detail.do?id=182335
10) Press "Refactor"
11) Drag MyClass back to com.demo.test
12) Exception thrown again: http://statistics.netbeans.org/analytics/detail.do?id=182335 
13) Invoke code completion in MyClass as follows:
package com.demo.test;

public class MyClass {
    private MyService service;
    
    public void doSomething() {
        service.go|
    }
}

14) Press Command+Z (or Ctrl+Z) to undo. Exception will be thrown.
15) After pressing Command+Z and Command+Shift+Z for a while to replicate the issue, I got this exception: http://statistics.netbeans.org/exceptions/detail.do?id=182426
Comment 9 dbell 2011-10-30 12:44:26 UTC
Reproduced with simpler scenario. Still in Maven project:
1) Create new class in test package com.demo.MyClass

package com.demo;

import java.io.File;

public class MyClass {

    public static class MyOtherClass {
       public void go(File file) {
           
       }
    }
    
    private MyOtherClass other;
    
    public void doSomething() {
        other.go
    }
    
}

2) Drag class to different test package (com.demo.other). Exception thrown.
3) Drag class back to original package (com.demo)
4) invoke code completion as shown below. Exception will be thrown.

package com.demo;

import java.io.File;

public class MyClass {

    public static class MyOtherClass {
       public void go(File file) {
           
       }
    }
    
    private MyOtherClass other;
    
    public void doSomething() {
        other.go|
    }
    
}
Comment 10 Milutin Kristofic 2012-09-13 15:29:06 UTC
*** Bug 216683 has been marked as a duplicate of this bug. ***
Comment 11 Milutin Kristofic 2012-11-08 18:23:49 UTC
*** Bug 204407 has been marked as a duplicate of this bug. ***
Comment 12 Vladimir Riha 2013-11-13 14:09:24 UTC
Created attachment 142138 [details]
stacktrace

Happened when following [1] when I tied to finish JavaScript REST Client wizard


[1] http://jaxenter.com/from-database-to-restful-web-service-to-html5-in-10-minutes-46064.html
Comment 13 rodrigorsantos 2013-11-25 12:52:01 UTC
Created attachment 142534 [details]
stacktrace

,
Comment 14 rodrigorsantos 2013-11-25 12:58:02 UTC
Created attachment 142536 [details]
stacktrace

<Please provide a description of the problem or the steps to reproduce>
Comment 15 Alexander Simon 2014-02-21 18:36:03 UTC
31 reports => P2
Comment 16 Miloslav Metelka 2014-02-26 12:39:22 UTC
(In reply to dbell from comment #9)
> Reproduced with simpler scenario. Still in Maven project:
This scenario does not fail for me (but it's that it no longer happens since it was entered on 2011-10-30).

Does anyone have any scenario that I could use to reproduce? Specifically for this problem without a reproducible test case I'm unable to make any progress.

Last few reports are caused by fold operation problems so I've entered issue #242363 for that problem.
Comment 17 Martin Balin 2016-07-07 07:31:39 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss