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 165014

Summary: Regression in org.openide.filesystems.FileUtil.getConfigFile()
Product: cnd Reporter: Alexander Simon <alexvsimon>
Component: -- Other --Assignee: Alexander Simon <alexvsimon>
Status: RESOLVED FIXED    
Severity: blocker CC: issues, jglick, jskrivanek, jtulach, vkvashin
Priority: P3 Keywords: REGRESSION, TEST
Version: 6.x   
Hardware: Sun   
OS: Solaris   
Issue Type: DEFECT Exception Reporter:
Attachments: exception

Description Alexander Simon 2009-05-13 08:52:04 UTC
Since May 12 some cnd unit tests failed.
See log.
Comment 1 Alexander Simon 2009-05-13 08:52:36 UTC
Created attachment 82015 [details]
exception
Comment 2 Jiri Skrivanek 2009-05-13 14:17:19 UTC
I can confirm the test fails on Linux (JDK1.5, JDK1.6) and Solaris (JDK1.6). It passes on Solaris (JDK1.5) and Windows
(JDK1.5, JDK1.6). But it fails on all history builds I have (since build 200904260201). It is not a regression. Do you
know when the test started to fail?
Comment 3 Alexander Simon 2009-05-13 14:49:33 UTC
CND has own incremental build:
http://elif.russia.sun.com:8080/hudson/job/cnd-incremental-build/
test start to fail since #2808 (12.05.2009 18:51:32)
Comment 4 Alexander Simon 2009-05-13 14:51:20 UTC
vkvashin: Please, comment status of incremental build.
Comment 5 Vladimir Kvashin 2009-05-13 15:00:45 UTC
I'd like to mention that the situation first occurred on May 12, and  reproduces quite stable starting from this period.
I can also reproduce it if I run tests on Solaris 10 remotely, i.e. via ssh, without DISPLAY variable set.
I just do 
  cd cnd.makeproject
  ant test
Comment 6 Vladimir Voskresensky 2009-05-14 08:24:33 UTC
tests are very important for us, please, provide at least workaround
Comment 7 Alexander Simon 2009-05-14 09:04:03 UTC
Work around is simple: run tests on jdk1.5
But it is very strange to see awt objects in UI less unit tests.
IMHO it should be fixed (because it can appear in other use cases).
Comment 8 Jaroslav Tulach 2009-05-14 09:27:11 UTC
It is indeed not sad if unit tests fail due to access to AWT. But I am not sure what could be cause of the failure. 
Last change in core.startup was

changeset:   130145:9578d8c64ae1
user:        Jesse Glick <jglick@netbeans.org>
date:        Tue May 05 13:18:32 2009 -0400
summary:     #164510: faster impl of shouldDelegateClasspathResource.


Anyway I'd suggest a fix in the following place
org.netbeans.core.startup.Main.setStatusText(Main.java:83) 
The fix shall check Toolkit.isHeadlessMode() (or something similar) and in such case don't try to call into Splash at 
all. Or catch and log the exception, but continue to run on.
Comment 9 Jiri Skrivanek 2009-05-14 09:34:21 UTC
The problem is in this line

System.setProperty("os.name", "Windows Vista");

If you remove it, it starts to work on Linux too. Probably not a good idea to set this system property.
Comment 10 Alexander Simon 2009-05-14 10:24:30 UTC
Your approach prevents developers from writing platform dependent unit tests :-(
Comment 11 Alexander Simon 2009-05-14 10:25:05 UTC
fixed in change set 
http://hg.netbeans.org/cnd-main/rev/db82d1ea6d1b
Comment 12 Alexander Simon 2009-05-14 10:41:22 UTC
By the way org.openide.util.UtilitiesTest sets OS property.
It would be nice to provide developers a method to reset OS in unit tests.