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 207077

Summary: Hints run on modified layer.xml
Product: apisupport Reporter: Martin Fousek <marfous>
Component: RefactoringAssignee: Jesse Glick <jglick>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P3    
Version: 7.1   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter: 184263
Attachments: stacktrace

Description Martin Fousek 2012-01-09 17:53:55 UTC
Build: NetBeans IDE 7.1 RC1 (Build 201111242103)
VM: Java HotSpot(TM) 64-Bit Server VM, 20.4-b02, Java(TM) SE Runtime Environment, 1.6.0_29-b11
OS: Linux

User Comments:
marfous: invoked hints in layer.xml to re-registration action via annotations




Stacktrace: 
java.lang.Throwable: Locked by:
   at org.openide.filesystems.FileLock.<init>(FileLock.java:83)
   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:353)
   at org.openide.loaders.MultiDataObject$Entry.takeLock(MultiDataObject.java:1352)
   at org.netbeans.modules.openide.loaders.SimpleES$Environment.takeLock(SimpleES.java:188)
Comment 1 Martin Fousek 2012-01-09 17:53:58 UTC
Created attachment 114738 [details]
stacktrace
Comment 2 Jesse Glick 2012-01-11 18:33:25 UTC
jtulach's analysis does not seem right; LayerUtils.CookieImpl.run closes the stream in a finally block, which should suffice to unlock the file.

Rather the issue is that the file is locked by the editor because it is modified, yet Hinter.Context.saveLayer is being called which is trying to save structural modifications. LayerHints cancels all hints as soon as the layer is modified, but perhaps there is a race condition if you accept a hint and then start typing text in layer.xml before it gets a chance to run, perhaps because Java scanning is running.
Comment 3 Jesse Glick 2012-01-11 18:45:58 UTC
core-main #320aba7a7628
Comment 4 Quality Engineering 2012-01-13 21:53:21 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/320aba7a7628
User: Jesse Glick <jglick@netbeans.org>
Log: #207077: Hints run on modified layer.xml