Bug 230529 - NullPointerException at org.netbeans.modules.testng.actions.TestNGTestCreatorProvider.createTests
NullPointerException at org.netbeans.modules.testng.actions.TestNGTestCreator...
Status: VERIFIED FIXED
Product: java
Classification: Unclassified
Component: TestNG
7.3.1
All All
: P1 (vote)
: 7.3.1
Assigned To: Theofanis Oikonomou
issues@java
EXCEPTIONS_REPORT, 73patch2-verified
: REGRESSION
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-05-30 13:16 UTC by Jiri Kovalsky
Modified: 2013-06-06 13:00 UTC (History)
7 users (show)

See Also:
Issue Type: DEFECT
:


Attachments
stacktrace (3.41 KB, text/plain)
2013-05-30 13:16 UTC, Jiri Kovalsky
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Kovalsky 2013-05-30 13:16:39 UTC
Build: NetBeans IDE 7.3 (Build 201305291404)
VM: Java HotSpot(TM) 64-Bit Server VM, 23.25-b01, Java(TM) SE Runtime Environment, 1.7.0_25-b13
OS: Linux

User Comments:
jkovalsky: Installed full 7.3 distro as root, ran as user on JDK 7 Update 25 64b, activated JavaSE, updated to Patch 1, updated to 7.3.1 and opened Maven based UnitTestingExample project from issue #230464. Tried to create TestNG tests on "second" Java package but nothing happened not counting this NPE..




Stacktrace: 
java.lang.NullPointerException
   at org.netbeans.modules.testng.actions.TestNGTestCreatorProvider.createTests(TestNGTestCreatorProvider.java:129)
   at org.netbeans.modules.gsf.testrunner.TestCreatorAction.performAction(TestCreatorAction.java:138)
   at org.openide.util.actions.NodeAction$DelegateAction$1.run(NodeAction.java:586)
   at org.openide.util.actions.ActionInvoker$1.run(ActionInvoker.java:95)
   at org.openide.util.actions.ActionInvoker.doPerformAction(ActionInvoker.java:116)
   at org.openide.util.actions.ActionInvoker.invokeAction(ActionInvoker.java:99)
Comment 1 Jiri Kovalsky 2013-05-30 13:16:40 UTC
Created attachment 135135 [details]
stacktrace
Comment 2 Jiri Kovalsky 2013-05-30 13:52:55 UTC
Reproducible. Cannot create any TestNG tests in a Maven based Java project if IDE was installed as root and run as user. JUnit and Ant based projects work fine. Increasing priority.
Comment 3 Jiri Kovalsky 2013-05-30 14:54:36 UTC
I have also found out that this is a regression caused by 7.3.1. It does not happen in NetBeans 7.3 only after I updated the IDE.
Comment 4 Marian Mirilovic 2013-05-31 06:10:51 UTC
Fanis, please evaluate ASAP.
Comment 5 Theofanis Oikonomou 2013-05-31 08:03:52 UTC
Product Version: NetBeans IDE 7.3 (Build 201305301707)
Java: 1.7.0_21; Java HotSpot(TM) 64-Bit Server VM 23.21-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_21-b11
System: Linux version 3.5.0-30-generic running on amd64; UTF-8; en_US (nb)
User directory: /tmp/230529
Cache directory: /tmp/230529/var/cache

1) installed 7.3 as root (got installed in /usr/local)
2) started it as user with clean userdir
3) did all the offered updates
4) updated to 7.3.1
5) opened maven j2se project
6) tried to create the TestNG test => got created OK
7) did some more updates from 7.3.1 (due to activation of java support from
opening the project)
8) removed the test classes and dependency from the project
9) tried to create the TestNG test again => got created OK

so not reproducible for me. Did I miss some step?
Comment 6 Theofanis Oikonomou 2013-05-31 08:11:36 UTC
I used different jdk version. I will test also with u25 and report back.
Comment 7 Jiri Kovalsky 2013-05-31 08:44:56 UTC
Also please install the IDE into your user's home directory, not root's one. I am trying to reproduce this on today's build. Stay tuned as well.
Comment 8 Jiri Kovalsky 2013-05-31 08:50:32 UTC
Good news. I was NOT able to reproduce it on:

Product Version: NetBeans IDE 7.3.1 (Build 201305301707)
Java: 1.7.0_25; Java HotSpot(TM) 64-Bit Server VM 23.25-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_25-b13
System: Linux version 3.0.0-12-generic running on amd64; UTF-8; cs_CZ (nb)
User directory: /home/cesilko/.netbeans/7.3.1
Cache directory: /home/cesilko/.cache/netbeans/7.3.1

So the only difference from my yesterday's work is the cumbersome update scenario. Will try to reproduce it once again with every detail recorded...
Comment 9 Jiri Kovalsky 2013-05-31 09:10:33 UTC
OK, so here is the full scenario reproducing the problem. I am Linux Mint 12 if it matters.

0. Become root (su).
1. Launch full 7.3 distro installer (netbeans-7.3-linux.sh)
2. Disable installation of GlassFish but enable JUnit installation.
3. Set destination to /home/cesilko/netbeans-7.3 and use /home/cesilko/Java/jdk1.7.0_25_64b.
4. Disable check for updates and install the IDE.
5. As user launch NetBeans 7.3, ignore import of 7.2.1 settings and go to "Tools > Plugins".
6. On "Installed" tab activate "Java SE" cluster.
7. Update all suggested 17 modules on "Updates" tab and restart the IDE.
8. Go to "Tools > Plugins" again. Disable "Certified Plugins" and "Plugin Portal" update centers on "Settings" tab.
9. Change URL of "NetBeans Distribution" update center to http://dlc.sun.com.edgesuite.net/netbeans/updates/7.3/uc/final/distribution/catalog_stage.xml.gz
10. Update all suggested 20 modules on "Updates" tab and restart the IDE.
11. Invoke "File > New Project..." from main menu.
12. Select "Maven" category, "Java Application" project type and push "Next >" and then "Finish" buttons.
13. Cancel "Enable CVS Support" dialog.
14. Right click "Source Packages" and invoke "New > Java Package" from popup menu.
15. Confirm creation of the package by "Finish" button.
16. Right click "Source Packages | newpackage" and invoke "New > Java Class" from popup menu.
17. Confirm creation of the class by "Finish" button.
18. Right click "Source Packages | newpackage" and invoke "Tools > Create Tests" from popup menu.
19. Select "TestNG" framework in "Create Tests" dialog and push "OK" button.
20. The NPE is thrown and no test is created.
Comment 10 Theofanis Oikonomou 2013-05-31 13:11:27 UTC
I followed some more scenarios to narrow down the cause.

1) installed 7.3, followed steps from comment 9 => NPE
2) installed 7.3, followed steps from comment 9 but did not update to patch1 => NPE
3) installed 7.3 j2se, followed steps from comment 9 => No exception

So it seems to be a problem with ergonomics. re-assigning
Comment 11 Theofanis Oikonomou 2013-05-31 15:28:10 UTC
Tried steps from comment 9 and after activating java support both ant/maven testng support is activated. After updating to patch 2 maven testng support is deactivated and this is why we get the NPE. After activating maven testng support from the plugins dialog there is no NPE
Comment 12 Jaroslav Tulach 2013-06-01 12:20:02 UTC
NPE is likely caused by findTestNGSupport returning null. findTestNGSupport seeks for TestNGSupportImplementation in Lookup and as far as Lahváč is aware there are three implementations: http://lahoda.info/index/ui/implements?type=CLASS:org.netbeans.modules.testng.spi.TestNGSupportImplementation
For our purposes the Maven one is important. However when I look at

~/nbuserdir73/config/Modules$ cat org-netbeans-modules-testng-maven.xml

<!DOCTYPE module PUBLIC "-//NetBeans//DTD Module Status 1.0//EN"
                        "http://www.netbeans.org/dtds/module-status-1_0.dtd">
<module name="org.netbeans.modules.testng.maven">
    <param name="autoload">false</param>
    <param name="eager">false</param>
    <param name="enabled">false</param>
    <param name="jar">modules/org-netbeans-modules-testng-maven.jar</param>
    <param name="reloadable">false</param>
</module>

I can see the module is disabled. I see no connection with ergonomics - it is up to owner of TestNG to find out why.

PS: I am surprised a of this kind is not eager or autoload providing org.netbeans.modules.testng.spi.TestNGSupportImplementation token which some other module would request.
Comment 13 Theofanis Oikonomou 2013-06-03 11:08:36 UTC
I cannot reproduce today using the installation from Friday and following the steps from comment 9. 

Things I noticed:
After step 6 everything under Java SE/Testing Tools categories in plugins dialog were activated.
After step 10 when ide restarts only Ant,Java, Java Profiler from Java SE category and Ant TestNG Support from Testing Tools category are activated.
After step 11 everything under Java SE/Testing Tools categories in plugins dialog are activated which leads to no NPE thrown

Jirko can you still reproduce? Thank you
Comment 14 Jiri Kovalsky 2013-06-03 11:26:53 UTC
Going to try this out right away. Don't hang up...
Comment 15 Jiri Kovalsky 2013-06-03 11:45:37 UTC
Yes, I am able to reproduce the exception with today's content of the live [1] and staged [2] Update Centers.

[1] http://dlc.sun.com.edgesuite.net/netbeans/updates/7.3/uc/final/distribution/catalog.xml.gz
[2] http://dlc.sun.com.edgesuite.net/netbeans/updates/7.3/uc/final/distribution/catalog_stage.xml.gz
Comment 16 Antonin Nebuzelsky 2013-06-03 12:05:11 UTC
(In reply to comment #12)
> I can see the module is disabled. I see no connection with ergonomics - it is
> up to owner of TestNG to find out why.

Jarda, can you help Fanis with the evaluation?

Why is the module disabled after the restart when it was enabled before? Isn't this caused by feature-off functionality of ergonomics?
Comment 17 Antonin Nebuzelsky 2013-06-03 13:04:48 UTC
Further evaluation has revealed that ide-ergonomics.nbm which is a part of the patch 2 includes config.xml which turns off the testng.maven module. Reassigning back to ergonomics for further investigation.
Comment 18 Jaroslav Tulach 2013-06-03 14:57:26 UTC
(In reply to comment #17)
> Further evaluation has revealed that ide-ergonomics.nbm which is a part of the
> patch 2 includes config.xml which turns off the testng.maven module.
> Reassigning back to ergonomics for further investigation.

OK. That explains why the module is disabled. On the other hand it does not explain why we are getting NPE in such case. If the code is not ready for testng.maven module being enabled, it should recover from the NPE somehow. My favorite fix is:

diff -r ce962b7ce537 testng.maven/nbproject/project.properties
--- a/testng.maven/nbproject/project.properties Thu May 30 16:25:42 2013 +0200
+++ b/testng.maven/nbproject/project.properties Mon Jun 03 16:55:45 2013 +0200
@@ -49,3 +49,5 @@
 javac.compilerargs=-Xlint -Xlint:-serial
 nbm.homepage=http://wiki.netbeans.org/TestNG
 nbm.module.author=Lukas Jungmann
+is.eager=true
+

after rebuilding testng.maven and ide.ergonomics and inserting ide.ergonomics into 7.3 branch, I managed to create the TestNG test without problems.
Comment 19 Jaroslav Tulach 2013-06-03 16:36:42 UTC
I was curious why this bug manifests only with Maven+TestNg, but not Ant+TestNg. Well, is not that because asymetric dependencies in java.kit?

$ grep java.kit/testng nbproject/*
nbproject/project.xml:                    <code-name-base>org.netbeans.modules.testng</code-name-base>
nbproject/project.xml:                    <code-name-base>org.netbeans.modules.testng.ant</code-name-base>

Should not there also be a dependency on testng.maven (until it is made an eager module)?
Comment 20 Theofanis Oikonomou 2013-06-04 10:37:02 UTC
Fixed in release73 branch:http://hg.netbeans.org/releases/rev/71ab440fef09
and also in trunk:http://hg.netbeans.org/core-main/rev/2379497b1cd7
as per suggestion from comment 19
Comment 21 Jiri Kovalsky 2013-06-06 13:00:44 UTC
Product Version: NetBeans IDE 7.3 (Build 201306052037)
Updates: NetBeans IDE is updated to version NetBeans 7.3 Patch 2
Java: 1.7.0_25; Java HotSpot(TM) 64-Bit Server VM 23.25-b01
Runtime: Java(TM) SE Runtime Environment 1.7.0_25-b13
System: Linux version 3.0.0-12-generic running on amd64; UTF-8; cs_CZ (nb)
User directory: /home/cesilko/.netbeans/7.3
Cache directory: /home/cesilko/.cache/netbeans/7.3

Excellent. I am happy to announce that the fix has been successful and no java.lang.NullPointerException is being thrown now after the 7.3 > 7.3 Patch 1 > 7.3 Patch 2 update. TestNG tests were created so I take the liberty of closing this issue as VERIFIED. Thanks Jardo & Theofanis!


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo