Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 186876 - bundle.properties is not in saved state, resulting in locked file
bundle.properties is not in saved state, resulting in locked file
Status: VERIFIED FIXED
Product: utilities
Classification: Unclassified
Component: Properties
6.x
PC All
: P2 (vote)
: 7.0
Assigned To: Victor Vasilyev
issues@utilities
69patch1
:
: 187917 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-05-28 10:02 UTC by Kenneth Ganfield
Modified: 2010-06-28 14:03 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kenneth Ganfield 2010-05-28 10:02:00 UTC
When adding an item from the palette to a window component, the bundle.properties file is modified but somehow is not saved. When trying to create a new action with the wizard that will also modify the bundle.properties, wizard cannot complete, but does create action class

1. Create NetBeans module
2. Use New Window wizard to create a new window.
3. Add eg a label or text field to the component. Save.

4. Open New Action wizard.
5. Select Always Enabled. Click Next.
6. Use default GUI Registration settings. Click Next.
7. Type Class Name and Display Name. Click Finish.

When you click Finish the wizard displays a warning with the path to Bundle.properties file.
You cannot use Finish button to complete the wizard.

However, even without clicking Finish the wizard has already created the class for the new action.

The IDE log shows a FileAlreadyLockedException for the bundle properties.
If you open Bundle.properties in the editor, the file name is in bold to show that it has unsaved changes. Save All button and Ctrl-S do not save the file.
If you click the close button for the properties file the dialog prompting you to save the file appears. you can click Save to save the file. After doing this you can use the New Action wizard to create an action without problems.

Also, this only happens when you create the window (or e.g new JPanel Form) and add something from the palette before creating the action. If you create a window and do not add anything from the palette the problem does not occur 

If you create the action before the window there is no problem.
So seems that there is something about modifying the bundle properties that leaves it in some unsaved state resulting in the locked file.

Here is the output from the IDE log


org.openide.filesystems.FileAlreadyLockedException: /Users/nb/Documents/nbtemp-project/69-rc11/module2test/src/org/mytest/Bundle.properties
        at org.netbeans.modules.masterfs.filebasedfs.fileobjects.LockForFile.registerLock(LockForFile.java:114)
        at org.netbeans.modules.masterfs.filebasedfs.fileobjects.LockForFile.tryLock(LockForFile.java:103)
        at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObj.lock(FileObj.java:331)
        at org.openide.filesystems.FileObject.getOutputStream(FileObject.java:685)
        at org.netbeans.modules.apisupport.project.Util.storeProperties(Util.java:408)
        at org.netbeans.modules.apisupport.project.CreatedModifiedFilesFactory$BundleKey.run(CreatedModifiedFilesFactory.java:411)
        at org.netbeans.modules.apisupport.project.CreatedModifiedFiles.run(CreatedModifiedFiles.java:186)
        at org.netbeans.modules.apisupport.project.ui.wizard.action.NewActionIterator.instantiate(NewActionIterator.java:70)
        at org.openide.loaders.TemplateWizard$InstantiatingIteratorBridge.instantiate(TemplateWizard.java:1021)
        at org.openide.loaders.TemplateWizard.handleInstantiate(TemplateWizard.java:591)
        at org.openide.loaders.TemplateWizard.instantiateNewObjects(TemplateWizard.java:412)
        at org.openide.loaders.TemplateWizardIterImpl.instantiate(TemplateWizardIterImpl.java:251)
        at org.openide.loaders.TemplateWizardIteratorWrapper.instantiate(TemplateWizardIteratorWrapper.java:164)
        at org.openide.WizardDescriptor.callInstantiateOpen(WizardDescriptor.java:1544)
        at org.openide.WizardDescriptor.callInstantiate(WizardDescriptor.java:1498)
        at org.openide.WizardDescriptor.access$1700(WizardDescriptor.java:130)
[catch] at org.openide.WizardDescriptor$Listener$2$1.run(WizardDescriptor.java:2069)
        at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1418)
        at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1957)
Comment 1 Jesse Glick 2010-05-28 14:31:59 UTC
(In reply to comment #0)
> If you open Bundle.properties in the editor, the file name is in bold to show
> that it has unsaved changes. Save All button and Ctrl-S do not save the file.
> If you click the close button for the properties file the dialog prompting you
> to save the file appears. you can click Save to save the file.

I have noticed this before too. I had thought that some rewrite in the properties module would have finally fixed the problems with saving, but it has not - you cannot trivially save a properties file.
Comment 2 Antonin Nebuzelsky 2010-06-01 14:31:45 UTC
Raising priority. This is not a P3.
Comment 3 Victor Vasilyev 2010-06-03 03:00:03 UTC
I've noticed that it is a common issue with locking files in the wizards, not only with the properties files.

Steps to reproduce:

1. Create NetBeans module. Switch on the flag "Generate XML Layer".
2. Open the layer.xml in the editor, modify it (e.g. by adding the comment 
<!-- --> ), but don't save it!
3. Open New Action wizard, and try to complete it.

Result: 
The layer.xml is mentioned in both list of modified files and a warning message on wizard's panel. And, also exception in the IDE log:

java.lang.Throwable: Locked by:
        at org.openide.filesystems.FileLock.<init>(FileLock.java:80)
        at org.netbeans.modules.masterfs.filebasedfs.fileobjects.LockForFile.<init>(LockForFile.java:88)
        at org.netbeans.modules.masterfs.filebasedfs.fileobjects.LockForFile.tryLock(LockForFile.java:99)
        at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObj.lock(FileObj.java:328)
        at org.openide.loaders.MultiDataObject$Entry.takeLock(MultiDataObject.java:1189)
        at org.netbeans.modules.xml.XMLDataLoader$XMLFileEntry.takeLock(XMLDataLoader.java:375)
        at org.netbeans.modules.xml.text.TextEditorSupport$Env.takeLock(TextEditorSupport.java:649)
        at org.openide.text.DataEditorSupport$Env.markModified(DataEditorSupport.java:854)
        at org.openide.text.CloneableEditorSupport.notifyModified(CloneableEditorSupport.java:1927)
        at org.netbeans.modules.xml.text.TextEditorSupport.notifyModified(TextEditorSupport.java:255)
        at org.openide.text.CloneableEditorSupport.callNotifyModified(CloneableEditorSupport.java:1895)
        at org.openide.text.CloneableEditorSupport$Listener.vetoableChange(CloneableEditorSupport.java:2852)
        at org.netbeans.editor.BaseDocument.notifyModify(BaseDocument.java:1861)
        at org.netbeans.editor.BaseDocument.atomicUnlockImpl(BaseDocument.java:1819)
        at org.netbeans.editor.BaseDocument.atomicUnlockImpl(BaseDocument.java:1774)
        at org.netbeans.editor.GuardedDocument.runAtomicAsUser(GuardedDocument.java:350)
        at org.netbeans.editor.BaseKit$DefaultKeyTypedAction.actionPerformed(BaseKit.java:1074)
        at org.netbeans.editor.ext.ExtKit$ExtDefaultKeyTypedAction.actionPerformed(ExtKit.java:1064)
        at org.netbeans.editor.BaseAction.actionPerformed(BaseAction.java:336)
        at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1633)
        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:6040)
        at java.awt.Container.processEvent(Container.java:2041)
        at java.awt.Component.dispatchEventImpl(Component.java:4630)
        at java.awt.Container.dispatchEventImpl(Container.java:2099)
        at java.awt.Component.dispatchEvent(Component.java:4460)
        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:4502)
        at java.awt.Container.dispatchEventImpl(Container.java:2099)
        at java.awt.Window.dispatchEventImpl(Window.java:2478)
        at java.awt.Component.dispatchEvent(Component.java:4460)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
        at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:134)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused: org.openide.filesystems.FileAlreadyLockedException: V:\Users\vvg\Documents\NetBeansProjects\module7\src\m7\layer.xml
        at org.netbeans.modules.masterfs.filebasedfs.fileobjects.LockForFile.registerLock(LockForFile.java:111)
        at org.netbeans.modules.masterfs.filebasedfs.fileobjects.LockForFile.tryLock(LockForFile.java:100)
        at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObj.lock(FileObj.java:328)
        at org.openide.filesystems.FileObject.getOutputStream(FileObject.java:682)
        at org.netbeans.modules.apisupport.project.layers.LayerUtils$CookieImpl.run(LayerUtils.java:370)
        at org.openide.filesystems.EventControl.runAtomicAction(EventControl.java:122)
        at org.openide.filesystems.FileSystem.runAtomicAction(FileSystem.java:539)
        at org.netbeans.modules.apisupport.project.layers.LayerUtils$CookieImpl.save(LayerUtils.java:364)
        at org.netbeans.modules.apisupport.project.api.LayerHandle.save(LayerHandle.java:228)
        at org.netbeans.modules.apisupport.project.CreatedModifiedFiles.run(CreatedModifiedFiles.java:187)
        at org.netbeans.modules.apisupport.project.ui.wizard.action.NewActionIterator.instantiate(NewActionIterator.java:67)
        at org.openide.loaders.TemplateWizard$InstantiatingIteratorBridge.instantiate(TemplateWizard.java:1018)
        at org.openide.loaders.TemplateWizard.handleInstantiate(TemplateWizard.java:588)
        at org.openide.loaders.TemplateWizard.instantiateNewObjects(TemplateWizard.java:409)
        at org.openide.loaders.TemplateWizardIterImpl.instantiate(TemplateWizardIterImpl.java:248)
        at org.openide.loaders.TemplateWizardIteratorWrapper.instantiate(TemplateWizardIteratorWrapper.java:161)
        at org.openide.WizardDescriptor.callInstantiateOpen(WizardDescriptor.java:1541)
        at org.openide.WizardDescriptor.callInstantiate(WizardDescriptor.java:1495)
        at org.openide.WizardDescriptor.access$1700(WizardDescriptor.java:127)
[catch] at org.openide.WizardDescriptor$Listener$2$1.run(WizardDescriptor.java:2066)
        at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1415)
        at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1954)
Comment 4 Victor Vasilyev 2010-06-07 11:35:46 UTC
Both bug 89029 and bug 175275 have a relation to this bug.
A best solution for NB 6.9 is to remove all changes that have been made in the scope of the mentioned bugs, and then to re-open the bug 89029.

Such solution will make implementation of the method notifyModified() closer to its "default" implementation that usually is used in other successors of the class ClonableEditorSupport.
And, consequently, behavior of the support for the properties files will be closer to supports of other files, and it will be more applicable in most of use cases in the NetBeans.
Comment 5 Victor Vasilyev 2010-06-07 19:24:15 UTC
Fixed in the main trunk
http://hg.netbeans.org/main/rev/4e6108713223
Comment 6 rbalada 2010-06-22 07:49:41 UTC
Please report on progress, especially if you can make it into 6.9.1, if not please consider removing 6.9.1_CANDIDATE keyword.

Thanks,
-R
Comment 7 Alexei Mokeev 2010-06-22 08:29:08 UTC
Fixed by http://hg.netbeans.org/main/rev/4e6108713223.
Changing the status.
Comment 8 rbalada 2010-06-23 22:30:39 UTC
Please verify bugfix for this bug ASAP, so it can be integrated into release691
repository.

Thanks,
-R
Comment 9 rbalada 2010-06-25 06:16:29 UTC
Last chance for inclusion in release691.

Please verify within 4 hours from now, since I have got limited time to transplant remaining bugfixes into release691 repository. June 25, 1 PM Prague time is my deadline. After that time, please do also the transplant/porting work if you want to include it.

Thank you for understanding,
-R
Comment 10 rbalada 2010-06-28 09:43:19 UTC
main #4e6108713223 transplanted to release691 #19142235055b
Comment 11 Victor Vasilyev 2010-06-28 14:03:38 UTC
*** Bug 187917 has been marked as a duplicate of this bug. ***


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo