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 112349 - "Already locked" exception in ...editor.Utilities.reformat
Summary: "Already locked" exception in ...editor.Utilities.reformat
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: issues@editor
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-08 20:30 UTC by err
Modified: 2007-11-05 13:44 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
exceptions resulting in stuck lock (5.77 KB, text/plain)
2007-08-08 20:32 UTC, err
Details

Note You need to log in before you can comment on or make changes to this bug.
Description err 2007-08-08 20:30:41 UTC
Unsurprisingly, invoking ...editor.Utilities.reformat() when the document write lock is held gives an exception.

But trying the same operation again gives (full exceptions attached):
    java.lang.IllegalStateException: Already locked
        at org.netbeans.modules.editor.indent.IndentImpl.reformatLock(IndentImpl.java:128)

Which look like an exception handling problem in JavaSource locking code.
Comment 1 err 2007-08-08 20:32:16 UTC
Created attachment 46364 [details]
exceptions resulting in stuck lock
Comment 2 Jan Lahoda 2007-08-08 21:25:02 UTC
Seems like a bug in org.netbeans.modules.editor.indent.IndentImpl.reformatLock to me - this method sets flag that it is
locked (reformatHandler != null), and then the locking fails because of the exception. The Utilities.reformat then will
not unlock it, which is correct, as the reformatLock method should be all or nothing, IMO.
Comment 3 Miloslav Metelka 2007-08-13 10:55:11 UTC
I see. The reformatHandler is always assigned even if one of the items' locking fails. Should be fixed now.
Checking in IndentImpl.java;
/cvs/editor/indent/src/org/netbeans/modules/editor/indent/IndentImpl.java,v  <--  IndentImpl.java
new revision: 1.9; previous revision: 1.8
done
Checking in TaskHandler.java;
/cvs/editor/indent/src/org/netbeans/modules/editor/indent/TaskHandler.java,v  <--  TaskHandler.java
new revision: 1.8; previous revision: 1.7