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 138721 - Commit validation failing on Macs
Summary: Commit validation failing on Macs
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: NB JUnit (show other bugs)
Version: 6.x
Hardware: Macintosh Mac OS X
: P1 blocker (vote)
Assignee: Jesse Glick
URL:
Keywords: TEST
: 139086 (view as bug list)
Depends on:
Blocks: 136914
  Show dependency tree
 
Reported: 2008-07-01 15:46 UTC by Joelle Lam
Modified: 2009-09-29 22:19 UTC (History)
6 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
commit validation with patch (884.35 KB, text/plain)
2008-07-02 01:32 UTC, Joelle Lam
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joelle Lam 2008-07-01 15:46:05 UTC
Commit validation has been failing for my on Mac for the past week.  Usually I expect a few random failures but sometime
mid week I started getting a totally different failure.  I believe my failure is on the dt.jar dependency (per
#24499d81bb5c).

>     [junit] Warning - could not install module Form Editor
>     [junit]     Form Editor - This module requires JDKHOME/lib/dt.jar to be accessible.
>     [junit] This file was not found. Usually this means you are trying to run the IDE with the JRE instead of the full
JDK.
>     [junit] If so, please use the --jdkhome command line option to specify a JDK installation.
>     [junit] For more information see http://wiki.netbeans.org/FaqRunningOnJre
I have set my JDKHOME, JAVA_HOME, and my netbeans_jdkhome in the conf file to:
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/
I have even added to my CLASSPATH: /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/dt.jar
>     [junit]   Java Home               = /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home

The worse part of this failure is that it take 15 minutes to fail out completely when you actually see this error about
45 seconds into the test.  Shouldn't we failout (and stop tests) if dt.jar is not found?

I have been struggling with commit validation the past three days so any help from Mac users would be extremely appreciated.

Commit Validation Output: http://wiki.netbeans.org/attach/JoelleLam/output.txt

I am running test from a clean build with no modification from trunk
Comment 1 Jesse Glick 2008-07-01 18:09:38 UTC
Yarda's on vacation so I might need to take on this one.
Comment 2 Jesse Glick 2008-07-01 18:13:00 UTC
What does System.getProperty("java.home") normally report for you? Does
/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/dt.jar exist by default?
Comment 3 Jesse Glick 2008-07-01 18:16:00 UTC
And what does System.getProperty("java.class.path") normally report? (E.g. in a hello-world j2seproject.)
Comment 4 Jesse Glick 2008-07-01 18:18:45 UTC
BTW the presence of /System/Library/Java/Extensions/junit-4.1.jar is a little disturbing. Why does this file exist?
Generally you should not be running builds and tests with extra JARs dumped in your extension CP.

NbModuleSuite, like pretty much everything else in NB, intentionally ignores your $CLASSPATH.
Comment 5 Joelle Lam 2008-07-01 18:46:24 UTC
java.home: /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home
java.class.path: /Users/joelle/NetBeansProjects/JavaApplication1/build/classes

dt.jar is located in Home by default.  
Macintosh-89:Versions joelle$ find /System/Library/Frameworks/JavaVM.framework/Versions/ -name dt.jar
/System/Library/Frameworks/JavaVM.framework/Versions//1.4.2/Classes/dt.jar
/System/Library/Frameworks/JavaVM.framework/Versions//1.4.2/Home/lib/dt.jar
/System/Library/Frameworks/JavaVM.framework/Versions//1.5.0/Classes/dt.jar
/System/Library/Frameworks/JavaVM.framework/Versions//1.5.0/Home/lib/dt.jar
/System/Library/Frameworks/JavaVM.framework/Versions//1.6.0/Classes/dt.jar
/System/Library/Frameworks/JavaVM.framework/Versions//1.6.0/Home/lib/dt.jar


The JUnit jar is residual that was required at one point to get junit working on my system.  I tried to remove it
recently and almost totally forgot about.  This would be causing this problem though, right?
Comment 6 Jesse Glick 2008-07-01 18:58:58 UTC
Do remove the junit.jar, though it is unlikely to be causing this problem.

Try the following patch (ant -f nbjunit/build.xml && ant commit-validation) and let me know if it works for you:

diff --git a/nbjunit/src/org/netbeans/junit/NbModuleSuite.java b/nbjunit/src/org/netbeans/junit/NbModuleSuite.java
--- a/nbjunit/src/org/netbeans/junit/NbModuleSuite.java
+++ b/nbjunit/src/org/netbeans/junit/NbModuleSuite.java
@@ -419,7 +419,11 @@
                 }
             }
             
-            File jdkLib = new File(new File(System.getProperty("java.home")).getParentFile(), "lib");
+            File jdkHome = new File(System.getProperty("java.home"));
+            if (!"Mac OS X".equals(System.getProperty("os.name"))) {
+                jdkHome = jdkHome.getParentFile();
+            }
+            File jdkLib = new File(jdkHome, "lib");
             if (jdkLib.isDirectory()) {
                 for (File jar : jdkLib.listFiles()) {
                     if (jar.getName().endsWith(".jar")) {
Comment 7 Joelle Lam 2008-07-02 01:32:25 UTC
Created attachment 63786 [details]
commit validation with patch
Comment 8 Joelle Lam 2008-07-02 01:36:09 UTC
The commit validation is now loading the dt.jar with the patch given.  The other failures look more like failures I am
used to (unfortunately mac commit-validation has never been stable).
Comment 9 Jesse Glick 2008-07-02 01:37:36 UTC
So this fixes the problem you were having, or no? I am confused by your last comment.
Comment 10 Jesse Glick 2008-07-03 15:12:47 UTC
Will not push until I get some kind of positive confirmation that the patch works. I cannot test it myself (other than
that it does not harm C/V on Linux).
Comment 11 Jaroslav Tulach 2008-07-07 07:58:27 UTC
*** Issue 139086 has been marked as a duplicate of this issue. ***
Comment 12 Jaroslav Tulach 2008-07-07 08:01:08 UTC
Guys, please help us verify that Jesse's patch is correct.
Comment 13 Milan Kubec 2008-07-07 10:22:44 UTC
I verified that Jesse's patch fixes the problem with inaccessible dt.jar on Mac.
Comment 14 Joelle Lam 2008-07-07 17:57:28 UTC
It works for me too.
Comment 15 Jesse Glick 2008-07-07 21:29:57 UTC
OK. core-main #73e6d83257f0
Comment 16 Quality Engineering 2008-07-09 04:12:40 UTC
Integrated into 'main-golden', available in NB_Trunk_Production #308 build
Changeset: http://hg.netbeans.org/main/rev/73e6d83257f0
User: Jesse Glick <jglick@netbeans.org>
Log: Issue #138721: commit validation fails on Macs due to tools.jar/dt.jar not being in CP.