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.
Build: NetBeans IDE 7.3.1 (Build 201304162201) VM: Java HotSpot(TM) Client VM, 23.21-b01, Java(TM) SE Runtime Environment, 1.7.0_21-b11 OS: Windows XP User Comments: lehel: From Netbeans menu I opened Tools-Servers, and was clicking on the existing servers (Apache Tomcat 7.0.34, Glassfish 4.0) Stacktrace: java.lang.NullPointerException at org.netbeans.modules.glassfish.common.utils.JavaUtils.findSupportedPlatforms(JavaUtils.java:197) at org.netbeans.modules.glassfish.common.ui.VmCustomizer.<init>(VmCustomizer.java:114) at org.netbeans.modules.glassfish.common.ui.GlassFishPropertiesCustomizer.<init>(GlassFishPropertiesCustomizer.java:158) at org.netbeans.modules.glassfish.common.GlassfishInstance.getCustomizer(GlassfishInstance.java:1468) at org.netbeans.api.server.ServerInstance.getCustomizer(ServerInstance.java:126) at org.netbeans.modules.server.ui.manager.ServerManagerPanel.selectServer(ServerManagerPanel.java:359)
Created attachment 133693 [details] stacktrace
This is not first time I see this NPE. Line 197 in .JavaUtils contains following code: if (supportedPlatforms.contains(JavaSEPlatform.toValue( platform.getSpecification().getVersion().toString()))) { Value of supportedPlatforms should not be null. It's initialized as empty set. Value of platformsList is initialized as empty LinkedList in the method itself. The only possible NPE is in platform.getSpecification().getVersion().toString() Unfortunately I have no chance to reprodice this issue.
I modified this piece of code to locate source of NPE. It will still show warning and an exception but also there will sole log messages in NetBeans log: } catch (NullPointerException npe) { LOGGER.log(Level.WARNING, "NullPointerException caught in findSupportedPlatforms.", npe); if (supportedPlatforms == null) { LOGGER.log(Level.INFO, "Value of supportedPlatforms is null."); } else if (platform.getSpecification() == null) { LOGGER.log(Level.INFO, "Value of platform.getSpecification() is null."); } else if ( platform.getSpecification().getVersion() == null) { LOGGER.log(Level.INFO, "Value of platform.getSpecification().getVersion() is null."); } At this point I need some help from you. I would like to ask you to reproduce this issue with this extended logging when next dev build will be available. Log will tell us which value caused NPE and I'll take care of it.
Checked into web-main: ---------------------- changeset: 251198:167e3b51cf27 branch: javaee7 summary: #228875 - Instrumented build to find NPE cause
To get just the j2se platforms the following method can be used: JavaPlatformManager.getPlatforms (null, new Specification("j2se", null))
I made final fix in 2 steps to keep NPE handling code in repository history. But it should not be there because getSpecification() and getVersion() for Java SE platform won't return null in any case. Verified this with Tomas Zezula. Checked into web-main: ---------------------- changeset: 251277:9d9c1cdd032e branch: javaee7 summary: #228875 - Only Java SE platforms are returned from default platform manager. NPE handling included. changeset: 251278:6ccc2c51e3d7 branch: javaee7 summary: #228875 - Removed NPE handling because Java SE platforms cannot throw NPE in getSpecification() and getVersion() methods.
*** Bug 228355 has been marked as a duplicate of this bug. ***
Integrated into 'releases', will be available in build *201304242201* or newer. Wait for official and publicly available build. Changeset: http://hg.netbeans.org/releases/rev/167e3b51cf27 User: Tomas Kraus <TomasKraus@netbeans.org> Log: #228875 - Instrumented build to find NPE cause
Integrated into 'main-golden', will be available in build *201304252301* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/167e3b51cf27 User: Tomas Kraus <TomasKraus@netbeans.org> Log: #228875 - Instrumented build to find NPE cause