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.
File system during getting lock (i.e. first typing in editor) calls beforeEdit which is delegated into VCSInterceptor.beforeEdit => ade should checkout file. But checkout can fail => VCS impl should notify about failed beforeEdit activity. The easiest way is to follow the same style as in other do* methods and add throw IOException into signature
we can change versioning.core.spi.VCSInterceptor.beforeEdit() and VCSFilesystemInterceptor.fileLoecked() as suggested, but that woud also imply changes in masterfs. jarda - please evaluate
Changing a method in masterfs to throw IOException is source incompatible, but binary compatible. As masterfs friends are always compiled at the same time as masterfs, and even if they will not, they will link (as the change is binary compatible), feel free to modify existing method to throw IOException.
VCSInterceptor.beforeEdit is new SPI not used by anyone except ADE as I know, right?
(In reply to comment #3) > VCSInterceptor.beforeEdit is new SPI not used by anyone except ADE as I know, > right? yes
btw, what is the public API method in masterfs which have to change signature due to change in VCSInterceptor.beforeEdit?
(In reply to comment #5) > btw, what is the public API method in masterfs which have to change signature > due to change in VCSInterceptor.beforeEdit? masterfs isn't public. but what has to change there in the first place is ProvidedExtensions.fileLocked()
Created attachment 116182 [details] suggested changes attached suggested changes in vcs and masterfs. i'm not very familiar with masterfs, jarda please have a look on ProvidedExtensions, ProvidedExtensionsProxy and on what is going on in FileObj.lock(). tried to emulate the requested behavior by throwing IOE from vcs in .beforeEdit() and the raised exception was: java.lang.Throwable: Locked by: at org.openide.filesystems.FileLock.<init>(FileLock.java:85) at org.netbeans.modules.masterfs.filebasedfs.fileobjects.LockForFile.<init>(LockForFile.java:91) at org.netbeans.modules.masterfs.filebasedfs.fileobjects.LockForFile.tryLock(LockForFile.java:102) at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObj.lock(FileObj.java:360) at org.openide.loaders.MultiDataObject$Entry.takeLock(MultiDataObject.java:1352) at org.netbeans.modules.openide.loaders.SimpleES$Environment.takeLock(SimpleES.java:188) at org.openide.text.DataEditorSupport$Env.markModified(DataEditorSupport.java:951) at org.openide.text.CloneableEditorSupport.notifyModified(CloneableEditorSupport.java:2001) at org.netbeans.modules.openide.loaders.SimpleES.notifyModified(SimpleES.java:123) at org.openide.text.CloneableEditorSupport.callNotifyModified(CloneableEditorSupport.java:1974) at org.openide.text.CloneableEditorSupport$Listener.vetoableChange(CloneableEditorSupport.java:2836) at org.netbeans.editor.BaseDocument.atomicLockImpl(BaseDocument.java:1633) at org.netbeans.editor.GuardedDocument.runAtomicAsUser(GuardedDocument.java:343) at org.netbeans.editor.BaseKit$DefaultKeyTypedAction.actionPerformed(BaseKit.java:1151) at org.netbeans.editor.ext.ExtKit$ExtDefaultKeyTypedAction.actionPerformed(ExtKit.java:1076) at org.netbeans.editor.BaseAction.actionPerformed(BaseAction.java:339) at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1645) at javax.swing.JComponent.processKeyBinding(JComponent.java:2851) at javax.swing.JComponent.processKeyBindings(JComponent.java:2886) at javax.swing.JComponent.processKeyEvent(JComponent.java:2814) at java.awt.Component.processEvent(Component.java:6150) at java.awt.Container.processEvent(Container.java:2085) at java.awt.Component.dispatchEventImpl(Component.java:4735) at java.awt.Container.dispatchEventImpl(Container.java:2143) at java.awt.Component.dispatchEvent(Component.java:4565) at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1850) at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:712) at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:990) at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:855) at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:676) at java.awt.Component.dispatchEventImpl(Component.java:4607) at java.awt.Container.dispatchEventImpl(Container.java:2143) at java.awt.Window.dispatchEventImpl(Window.java:2478) at java.awt.Component.dispatchEvent(Component.java:4565) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:679) at java.awt.EventQueue.access$000(EventQueue.java:85) at java.awt.EventQueue$1.run(EventQueue.java:638) at java.awt.EventQueue$1.run(EventQueue.java:636) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87) at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98) at java.awt.EventQueue$2.run(EventQueue.java:652) at java.awt.EventQueue$2.run(EventQueue.java:650) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87) at java.awt.EventQueue.dispatchEvent(EventQueue.java:649) at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:162) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188) [catch] at java.awt.EventDispatchThread.run(EventDispatchThread.java:122) thanks
I've put the masterfs changes into ergonomics#6bf35b6df318. I wrote a test that should eliminate the above exception caused by already locked file, imho. Back to version control now.
Integrated into 'main-golden', will be available in build *201203110400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/6bf35b6df318 User: Jaroslav Tulach <jtulach@netbeans.org> Log: #208657: The masterfs part of the changes. With documentation and test to verify the 'lock' state when IOException is thrown
fixed in core-main #5686e0db4f7d
Integrated into 'main-golden', will be available in build *201203170400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/5686e0db4f7d User: Tomas Stupka <tstupka@netbeans.org> Log: Issue #208657 - VCSInterceptor.beforeEdit should throw IOException if VCS operation failed