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 230387

Summary: Should not write to disk during startup (someone using NbPreferences)
Product: platform Reporter: Jiri Skrivanek <jskrivanek>
Component: ProxyAssignee: Libor Fischmeistr <lfischmeistr>
Status: VERIFIED FIXED    
Severity: normal Keywords: TEST
Priority: P2    
Version: 7.4   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: Stack traces from test.

Description Jiri Skrivanek 2013-05-28 13:46:43 UTC
Automated test discovered writes to disk during startup. To reproduce:

- open java.kit project in IDE
- open IDECommitValidationTest from Functional Test Packages
- run this test (Ctrl+F6). The first test case testWriteAccess should pass. But there are error messages like the following:

Writing any files to disk during start is inefficient and usualy unnecessary.
Consider using declarative registration in your layer.xml file, or delaying
the initialization of the whole subsystem till it is really used.
In case it is necessary to perform the write, you can modify the
'allowed-file-write.txt' file in ide.kit module. More details at
http://wiki.netbeans.org/FitnessViaWhiteAndBlackList

java.lang.Exception: checkWrite: D:\hg\main\java.kit\build\test\qa-functional\work\userdir0\config\Preferences\org\netbeans\core.properties
Comment 1 Jiri Skrivanek 2013-05-28 13:47:12 UTC
Created attachment 135006 [details]
Stack traces from test.
Comment 2 Theofanis Oikonomou 2013-05-29 09:40:33 UTC
I cannot reproduce on my machine

Product Version  = NetBeans IDE Dev (Build 20130528-091c5ab6f879) (#091c5ab6f879)
Operating System = Linux version 3.5.0-30-generic running on amd64
Java; VM; Vendor = 1.7.0_21; Java HotSpot(TM) 64-Bit Server VM 23.21-b01; Oracle Corporation
Runtime          = Java(TM) SE Runtime Environment 1.7.0_21-b11
Java Home        = /usr/lib/jvm/jdk1.7.0_21/jre

It looks like NbProxySelector is reloading the proxy settings and thus writes to NbPreferences during startup. re-assigning. Thank you
Comment 3 Jiri Rechtacek 2013-05-29 13:31:57 UTC
It's not a regression, the code works in the same way since 7.2 (at least)
Comment 4 Jiri Skrivanek 2013-05-29 13:46:00 UTC
Hardly the code works in the same way if core.network module was introduced in 7.4. But if you fix it I don't care it is a P1 regression or P2. Definitely it blocks commit validation tests.
Comment 5 Libor Fischmeistr 2013-05-29 13:50:59 UTC
(In reply to comment #4)
> Hardly the code works in the same way if core.network module was introduced in
> 7.4. But if you fix it I don't care it is a P1 regression or P2. Definitely it
> blocks commit validation tests.

Yes, the core.network has been introduced in 7.4, but the same functionality was in core module before. The code just has been moved. The writing to properties file during startup is the same as before the core.network has been introduced.
Comment 6 Libor Fischmeistr 2013-06-18 13:33:07 UTC
Moved to whitelist (config/Preferences/org/netbeans/core.properties)

http://hg.netbeans.org/core-main/rev/51be5fdf37c9