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 186946 - licensechanger fails accessing open editor files
Summary: licensechanger fails accessing open editor files
Status: RESOLVED FIXED
Alias: None
Product: contrib
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All All
: P3 normal (vote)
Assignee: _ tboudreau
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-29 23:28 UTC by javydreamercsw
Modified: 2014-01-13 13:28 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 170277


Attachments
stacktrace (2.74 KB, text/plain)
2010-05-29 23:28 UTC, javydreamercsw
Details
Test case. (5.28 KB, application/zip)
2010-06-04 09:53 UTC, Jan Lahoda
Details
Exception thrown when using the test case. (6.01 KB, text/plain)
2010-06-04 09:54 UTC, Jan Lahoda
Details

Note You need to log in before you can comment on or make changes to this bug.
Description javydreamercsw 2010-05-29 23:28:49 UTC
Build: NetBeans IDE Dev (Build 201005280001)
VM: Java HotSpot(TM) Client VM, 16.3-b01, Java(TM) SE Runtime Environment, 1.6.0_20-b02
OS: Windows Vista

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:331)
   at org.openide.loaders.MultiDataObject$Entry.takeLock(MultiDataObject.java:1192)
   at org.netbeans.modules.java.JavaDataObject$JavaEditorSupport$Environment.takeLock(JavaDataObject.java:149)
Comment 1 javydreamercsw 2010-05-29 23:28:53 UTC
Created attachment 99650 [details]
stacktrace
Comment 2 Jan Lahoda 2010-06-04 09:52:59 UTC
Jarda, could you please be more specific about what is the problem in java.source? The java.{source|hints} modify the document, which forces the DO to be marked as modified, which then takes the lock on the file. The methods in java.source that perform this are simply forwarding methods. The most suspicious method is DataEditorSupport$Env.markModified which even contains an XXX about this situation. So the problem should probably be resolved on openide.loaders level.

I was able to reproduce similar situation with plain platform+a custom module:
-download the attached module (186946-test.zip), unpack it and start it using a plain platform (no ide/java cluster needed)
-create a file /tmp/test.txt (the file will be cleared during this test, so be sure it does not contain any important data)
-using Window/Favorites, open /tmp/test.txt in editor, and modify it but do not save it
-go to File menu and press "Test"
-an exception similar to the one attached will occur (attached as 186946-exc.txt)

Normally, I would consider this to be a bug in the user's module, but as this was reassigned to java.source, this must have been considered to be a bug in NB. As I can reproduce virtually the same situation using plain platform, the problem will probably need to be fixed on platform level. Reassigning to openide.loaders.
Comment 3 Jan Lahoda 2010-06-04 09:53:41 UTC
Created attachment 99812 [details]
Test case.
Comment 4 Jan Lahoda 2010-06-04 09:54:28 UTC
Created attachment 99813 [details]
Exception thrown when using the test case.
Comment 5 Jaroslav Tulach 2010-06-16 05:14:12 UTC
I've just fixed similar bug 187074, but as the fix was in DefaultDataObject, the problem in JavaDataObject will have to be fixed somehow differently.
Comment 6 Jaroslav Tulach 2010-06-16 05:56:57 UTC
The problem is in:
 org.netbeans.modules.licensechanger.WizardPP$1.start(WizardPP.java:120)
it shall either read data from opened document or make sure the file is saved first.

Where is licensechanger component?
Comment 7 Peter Pis 2010-06-16 08:07:55 UTC
Reassigning.
Comment 8 nhoffmann 2014-01-13 13:28:36 UTC
Should be fixed in version 1.9 for NetBeans 7.3+. Seems to be related to issue 
#225423.