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 228875 - NullPointerException at org.netbeans.modules.glassfish.common.utils.JavaUtils.findSupportedPlatforms
Summary: NullPointerException at org.netbeans.modules.glassfish.common.utils.JavaUtils...
Status: RESOLVED FIXED
Alias: None
Product: serverplugins
Classification: Unclassified
Component: GlassFish (show other bugs)
Version: 7.3.1
Hardware: All All
: P3 normal (vote)
Assignee: TomasKraus
URL:
Keywords:
: 228355 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-04-23 06:13 UTC by lehel
Modified: 2013-04-26 02:46 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 200159


Attachments
stacktrace (10.13 KB, text/plain)
2013-04-23 06:13 UTC, lehel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description lehel 2013-04-23 06:13:29 UTC
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)
Comment 1 lehel 2013-04-23 06:13:32 UTC
Created attachment 133693 [details]
stacktrace
Comment 2 TomasKraus 2013-04-23 09:56:33 UTC
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.
Comment 3 TomasKraus 2013-04-23 11:59:33 UTC
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.
Comment 4 TomasKraus 2013-04-23 12:08:15 UTC
Checked into web-main:
----------------------
changeset:   251198:167e3b51cf27
branch:      javaee7
summary:     #228875 - Instrumented build to find NPE cause
Comment 5 Tomas Zezula 2013-04-23 14:37:15 UTC
To get just the j2se platforms the following method can be used:

JavaPlatformManager.getPlatforms (null, new Specification("j2se", null))
Comment 6 TomasKraus 2013-04-24 10:12:59 UTC
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.
Comment 7 TomasKraus 2013-04-24 11:47:13 UTC
*** Bug 228355 has been marked as a duplicate of this bug. ***
Comment 8 Quality Engineering 2013-04-25 00:18:38 UTC
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
Comment 9 Quality Engineering 2013-04-26 02:46:00 UTC
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