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 160239 - Tools > Java Platforms > Add Platform throws NPE if ergonomics enabled
Summary: Tools > Java Platforms > Add Platform throws NPE if ergonomics enabled
Alias: None
Product: java
Classification: Unclassified
Component: Platform (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: David Strupl
: 162800 (view as bug list)
Depends on:
Reported: 2009-03-13 05:54 UTC by _ tboudreau
Modified: 2009-05-06 20:42 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:

Module suite demonstrating the problem (18.84 KB, application/octet-stream)
2009-04-23 14:34 UTC, _ tboudreau
Sorry, try this one (1.82 MB, application/octet-stream)
2009-04-23 14:52 UTC, _ tboudreau

Note You need to log in before you can comment on or make changes to this bug.
Description _ tboudreau 2009-03-13 05:57:27 UTC
If ergonomics is enabled, and you open Tools > Java Platforms, there are no platforms listed at all.  If you click Add
Platform you get an exception DataObject.find() called on null.

Enabling Java support fixes this.  Not sure if this is a problem for ergonomics or the Java Platform module, but it's
very broken.
Comment 1 Jaroslav Tulach 2009-03-13 09:36:55 UTC
Generating NPE is definitely problem of the code.
Comment 2 _ tboudreau 2009-03-13 17:21:34 UTC
Well, yes, but if Java support is disabled, why is there a Tools > Java Platforms menu at all?
Comment 3 Jaroslav Tulach 2009-03-14 06:27:33 UTC
Potentially because of bug 159923, but I am not sure.
Comment 4 David Strupl 2009-03-18 17:33:39 UTC
I have just tried build from today's trunk and the menu item is not there. Closing as works for me unless someone
provides steps to reproduce (having java disabled and have the menu item there).
Comment 5 _ tboudreau 2009-04-23 14:34:24 UTC
Created attachment 80766 [details]
Module suite demonstrating the problem
Comment 6 David Strupl 2009-04-23 14:43:42 UTC
Reopenning after Tim provided the test cluster.
Comment 7 _ tboudreau 2009-04-23 14:52:04 UTC
Created attachment 80773 [details]
Sorry, try this one
Comment 8 _ tboudreau 2009-04-23 14:57:58 UTC
Try the attached suite.  It does cause the Java Platforms menu item to appear.

Create a directory such as C:\fake (the platform install implementation recognizes only dirs named "fake" as java

Skip the empty wizard panel, and press Finish.  The exception below is thrown.

The culprit is that PlatformsCustomizer tries to look up
Templates/Services/Platforms/org-netbeans-api-java-Platform/javaplatform.xml in the system fs and assumes it will exist,
but it does not.

A bigger problem which I will file separately is that while the Java Platforms menu item is visible, in fact if you
browse to your JDK, it is not recognized because the modules the recognize other Java Platforms are not enabled.

SEVERE [global]
java.lang.IllegalArgumentException: Called DataObject.find on null
        at org.openide.loaders.DataObject.find(
        at javax.swing.AbstractButton.fireActionPerformed(
        at javax.swing.AbstractButton$Handler.actionPerformed(
Comment 9 Jaroslav Tulach 2009-04-24 15:59:53 UTC
The Templates/Services/Platforms/org-netbeans-api-java-Platform/javaplatform.xml is in module.
The action is in
which does not have any dependency on j2seplatform one. You need to fix your module dependencies or get ready for the 
file missing.

Pavel will help you with the fix in case you want his help.
Comment 10 David Strupl 2009-04-24 16:15:09 UTC
I will fix the module dependencies.
Comment 11 David Strupl 2009-04-24 20:44:59 UTC
The dependency is in the other direction. Investigating.
Comment 12 Jaroslav Tulach 2009-04-24 21:44:52 UTC
You can make the dependency bidirectional by using OpenIDE-Module-Provides/Needs/Recommends. Or you can just prevent 
the NPE. What is correct depends on you Java guys. I can imagine that JavaCard development module could easily run 
without any JavaSE platform, although the current code seems to rely on JavaSE platform being around.
Comment 13 David Strupl 2009-04-24 21:52:56 UTC
I have a patch almost ready that moves the layer registration and couple of files "up" in the dependency chain (from
j2seplatform to java.platform.

The only problem I have now not to screw something ;-) I will try to finish and commit the move unless there are any

BTW I would like to know the reason why the template file was in one module and its wizard iterator in another - if
there was some reason to have it like this my move might break something that I am not aware about.
Comment 14 _ tboudreau 2009-04-25 00:16:25 UTC
> although the current code seems to rely on JavaSE platform being around.

It doesn't, although I think users might find it a little confusing if Java support is enabled but the IDE doesn't
recognize a JDK install.
Comment 15 David Strupl 2009-04-27 13:45:13 UTC
Pushed to jet-main as changeset:   128757:c121cd47a5b6

Ergonomics keyword does not mean that the bug was caused by bug in the ergonomics modules. It means that without
ergonomics you would not encounter it which I think is true since you would have the whole java cluster enabled whatever
would Tim do with JavaCard ... The bug is now correctly in category java/platform - this is where the bug is (was).
Comment 16 David Strupl 2009-04-27 16:26:14 UTC
Any help with the following failure is welcome:

I have tried to move the template and its display name in the bundle ... did I do it the wrong way?

Comment 17 David Strupl 2009-04-27 16:34:59 UTC
I apologize for the question. I have wrong localizing bundle there ... reopenning.
Comment 18 David Strupl 2009-04-27 16:39:50 UTC
And fixed again in changeset   : 128939:fa922dbd78dc in jet-main.
Comment 19 David Strupl 2009-05-06 20:42:01 UTC
*** Issue 162800 has been marked as a duplicate of this issue. ***