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 32798 - Regression: IllegalStateException instead of "attempt to modify gurded block"
Summary: Regression: IllegalStateException instead of "attempt to modify gurded block"
Status: VERIFIED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: -S1S-
Hardware: PC Windows ME/2000
: P1 blocker (vote)
Assignee: issues@editor
URL:
Keywords: REGRESSION
Depends on:
Blocks:
 
Reported: 2003-04-10 15:35 UTC by Jan Becicka
Modified: 2007-11-05 13:44 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IllegalStateException (2.04 KB, text/plain)
2003-04-10 15:37 UTC, Jan Becicka
Details
Full exception stacktrace (9.56 KB, text/plain)
2003-04-10 16:46 UTC, Martin Roskanin
Details
Binary patch for release35: Please use the attached jar to replace the corresponding classes in modules/ext/nb-editor.jar (22.08 KB, patch)
2003-04-11 11:36 UTC, Miloslav Metelka
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Becicka 2003-04-10 15:35:15 UTC
[030408]
Try to remove initComponents() method in the
Explorer. IllegalStateException is thrown, but
user friendly message "attempt to remove guarded
block" should appear.

This is a regression. See similar already fixed
issues (and their duplicates)
issue 9512
issue 22106
issue 21807
Comment 1 Jan Becicka 2003-04-10 15:37:00 UTC
Created attachment 9850 [details]
IllegalStateException
Comment 2 Jan Becicka 2003-04-10 16:03:36 UTC
On the other hand I must admit, that there is no data loss nor
deadlock, just misleading message. Please evaluate.
Comment 3 Martin Roskanin 2003-04-10 16:46:27 UTC
Created attachment 9852 [details]
Full exception stacktrace
Comment 4 Martin Roskanin 2003-04-10 16:52:23 UTC
The previous exceptions has been reproduced while trying modify the
source code via Java hierarchy API. 
Click on the guarded method initComponents(), invoke editor context
menu, choose customize, try to change the return type
Comment 5 Martin Roskanin 2003-04-10 17:20:05 UTC
Problem: after two atomicLocks the atomicDepth is set to level 1.
After unsuccessful operation in runAtomicAsUser the breakAtomicLock
method is called, which set the atomicDepth to 0. Then after the
atomicUnlock is called two times the exception is thrown. Also two times.

The javadoc of the method breakAtomicLock says:
"Even after calling this method, the atomicUnlock() must still be called."

In this case I would recommend do not set the value of atomicDepth to 0.

Comment 6 Miloslav Metelka 2003-04-11 10:47:48 UTC
Mato is right, it's necessary to remove setting of the atomicDepth to
zero in the breakAtomicLock().
 This regression resluted from a change that I've made in the
atomicUnlock() about two months ago. Originally it was possible to
call atomicUnlock() even though there was no corresponding
atomicLock() called before it. I've changed that to throw an exception
in such case because IMO it's a serious programatic error.
Unfortunately this revealed a bug (setting atomicDepth to zero) in the
breakAtomicLock() that was present there for a long time.
 I consider the issue to be a serious regression as any
NbDocument.runAtomicAsUser() touching the guarded section will throw
the annoying exception. If nobody objects I would like to fix the
issue in release35 too.

Fixed in the main trunk:
Checking in libsrc/org/netbeans/editor/BaseDocument.java;
/cvs/editor/libsrc/org/netbeans/editor/BaseDocument.java,v  <-- 
BaseDocument.java
new revision: 1.97; previous revision: 1.96

Comment 8 Miloslav Metelka 2003-04-11 11:36:18 UTC
Created attachment 9869 [details]
Binary patch for release35: Please use the attached jar to replace the corresponding classes in modules/ext/nb-editor.jar
Comment 9 ehucka 2003-04-11 12:29:34 UTC
I verified the patch for release35.
Comment 10 _ ttran 2003-04-11 15:15:25 UTC
waiting for code review...
Comment 11 Martin Roskanin 2003-04-11 15:24:55 UTC
Yes, the fix is OK.
I have already approve it ;-)
Comment 12 _ ttran 2003-04-11 17:35:59 UTC
approved for 3.5
Comment 13 Miloslav Metelka 2003-04-11 19:29:48 UTC
Integrated into release35:
Checking in libsrc/org/netbeans/editor/BaseDocument.java;
/cvs/editor/libsrc/org/netbeans/editor/BaseDocument.java,v  <-- 
BaseDocument.java
new revision: 1.92.2.2; previous revision: 1.92.2.1
Comment 14 ehucka 2003-04-14 10:06:13 UTC
Verified in release 35 build 200304132350.