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 110647 - Not locked. Use Indent.lock().
Summary: Not locked. Use Indent.lock().
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Formatting & Indentation (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: issues@editor
URL:
Keywords:
: 111993 112998 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-07-23 22:12 UTC by Torbjorn Norbye
Modified: 2007-11-05 13:39 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Torbjorn Norbye 2007-07-23 22:12:14 UTC
Intermittently while pressing newlines I'm getting the following exception; I don't exactly know how to reproduce it since it happens only occasionally. One 
thing which -may- be related is that I've pressed return twice rapidly when it was busy doing something else so it didn't immediately process the first 
newline - perhaps some kind of race condition?

Also note that this is on a Ruby file with my own IndentTask. My indent task doesn't call lock anywhere; it simply responds to the reindent() method and 
updates the source by calling doc.getFormatter().changeRowIndent() under a document write lock. If that is not the right way to do it let me know. Given 
that this bug is so intermittent I assumed it was related to a problem in the FormatterImpl or IndentImpl's handling of the indentation lock. (My indentLock 
method returns null.)

java.lang.AssertionError: Not locked. Use Indent.lock()
	at org.netbeans.modules.editor.indent.IndentImpl.reindent(IndentImpl.java:130)
	at org.netbeans.modules.editor.indent.FormatterImpl.indentLine(FormatterImpl.java:75)
	at org.netbeans.modules.editor.indent.FormatterImpl.indentNewLine(FormatterImpl.java:96)
	at org.netbeans.editor.BaseKit$SplitLineAction.actionPerformed(BaseKit.java:1177)
	at org.netbeans.editor.BaseAction.actionPerformed(BaseAction.java:266)
	at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1576)
	at javax.swing.JComponent.processKeyBinding(JComponent.java:2763)
	at javax.swing.JComponent.processKeyBindings(JComponent.java:2798)
	at javax.swing.JComponent.processKeyEvent(JComponent.java:2726)
	at java.awt.Component.processEvent(Component.java:5331)
	at java.awt.Container.processEvent(Container.java:2010)
	at java.awt.Component.dispatchEventImpl(Component.java:4021)
	at java.awt.Container.dispatchEventImpl(Container.java:2068)
	at java.awt.Component.dispatchEvent(Component.java:3869)
	at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1810)
	at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:672)
	at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:920)
	at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:798)
	at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:636)
	at java.awt.Component.dispatchEventImpl(Component.java:3907)
	at java.awt.Container.dispatchEventImpl(Container.java:2068)
	at java.awt.Window.dispatchEventImpl(Window.java:1774)
	at java.awt.Component.dispatchEvent(Component.java:3869)
[catch] at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
	at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Comment 1 Vitezslav Stejskal 2007-07-25 13:27:05 UTC
Milo, any ideas?
Comment 2 Miloslav Metelka 2007-07-26 14:27:01 UTC
Tor you've probably pressed Ctrl+Enter so that SplitLineAction was invoked. Unfortunately I did not wrap this one by the
locking (I had to miss it when I've searched for the usages). I'll fix it together with others that I possibly find.
Comment 3 Torbjorn Norbye 2007-07-26 14:58:44 UTC
Yes, that's quite possible...
Comment 4 Torbjorn Norbye 2007-07-26 23:48:26 UTC
Code templates seem to be broken. When I open a Ruby file and type "class" followed by Tab I get this exception:

java.lang.AssertionError: Not locked. Use Reformat.lock()
	at org.netbeans.modules.editor.indent.IndentImpl.reformat(IndentImpl.java:176)
	at org.netbeans.modules.editor.indent.FormatterImpl.reformat(FormatterImpl.java:117)
	at org.netbeans.lib.editor.codetemplates.CodeTemplateInsertHandler.insertTemplate(CodeTemplateInsertHandler.java:320)
	at org.netbeans.lib.editor.codetemplates.CodeTemplateInsertHandler.processTemplate(CodeTemplateInsertHandler.java:237)
	at org.netbeans.lib.editor.codetemplates.CodeTemplateManagerOperation.insert(CodeTemplateManagerOperation.java:222)
	at org.netbeans.lib.editor.codetemplates.api.CodeTemplate.insert(CodeTemplate.java:78)
	at org.netbeans.lib.editor.codetemplates.CodeTemplateAbbrevExpander.expand(CodeTemplateAbbrevExpander.java:48)
	at org.netbeans.lib.editor.codetemplates.AbbrevDetection.expand(AbbrevDetection.java:330)
	at org.netbeans.lib.editor.codetemplates.AbbrevDetection.checkExpansionKeystroke(AbbrevDetection.java:234)
	at org.netbeans.lib.editor.codetemplates.AbbrevDetection.keyPressed(AbbrevDetection.java:196)
	at java.awt.AWTEventMulticaster.keyPressed(AWTEventMulticaster.java:191)
	at java.awt.AWTEventMulticaster.keyPressed(AWTEventMulticaster.java:191)
Comment 5 Torbjorn Norbye 2007-07-26 23:50:03 UTC
Bumping to P2 - the abbreviation problem is more serious than the original intermittent problem I was seeing (possibly accidentally typing shift-return)
Comment 6 Miloslav Metelka 2007-08-02 17:06:59 UTC
Checking in libsrc/org/netbeans/editor/BaseKit.java;
/cvs/editor/libsrc/org/netbeans/editor/BaseKit.java,v  <--  BaseKit.java
new revision: 1.171; previous revision: 1.170
done
Checking in libsrc/org/netbeans/editor/Abbrev.java;
/cvs/editor/libsrc/org/netbeans/editor/Abbrev.java,v  <--  Abbrev.java
new revision: 1.31; previous revision: 1.30
done
Checking in libsrc/org/netbeans/editor/ActionFactory.java;
/cvs/editor/libsrc/org/netbeans/editor/ActionFactory.java,v  <--  ActionFactory.java
new revision: 1.87; previous revision: 1.86
done
Checking in codetemplates/src/org/netbeans/lib/editor/codetemplates/CodeTemplateInsertHandler.java;
/cvs/editor/codetemplates/src/org/netbeans/lib/editor/codetemplates/CodeTemplateInsertHandler.java,v  <-- 
CodeTemplateInsertHandler.java
new revision: 1.11; previous revision: 1.10
Comment 7 Jiri Prox 2007-08-06 09:34:47 UTC
*** Issue 111993 has been marked as a duplicate of this issue. ***
Comment 8 Jiri Prox 2007-08-16 14:40:34 UTC
*** Issue 112998 has been marked as a duplicate of this issue. ***