DataNucleus JIRA is now in read-only mode. Raise any new issues in GitHub against the plugin that it applies to. DataNucleus JIRA will remain for the foreseeable future but will eventually be discontinued
Issue Details (XML | Word | Printable)

Key: NUCCORE-866
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Yevgeny Shakhnovich
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.
DataNucleus Core

NullPointerException in NucleusContext.getStatistics()

Created: 28/Jun/12 11:12 PM   Updated: 06/Jul/12 10:00 AM   Resolved: 29/Jun/12 07:27 AM
Component/s: None
Affects Version/s: 3.1.0.m4
Fix Version/s: 3.1.0.m5

Environment: Linux, actually does not matter

 Description  « Hide
This code contains a bug. When statistics is null, using it in statistics.getClass() leads to NullPointerException. Actually, this code is full of bugs. Assume that getJMXManager returns null, you will use null as a name for FactoryStatistics

public synchronized FactoryStatistics getStatistics()
        if (statistics == null && statisticsEnabled())
            String name = null;
            if (getJMXManager() != null)
                // Register the MBean with the active JMX manager
                name = jmxManager.getDomainName() + ":InstanceName=" + jmxManager.getInstanceName() +
                    ",Type=" + ClassUtils.getClassNameForClass(statistics.getClass()) +
                    ",Name=Factory" + random.nextInt();
            statistics = new FactoryStatistics(name);
            if (jmxManager != null)
                // Register the MBean with the active JMX manager
                jmxManager.registerMBean(this.statistics, name);
        return statistics;

Andy Jefferson added a comment - 29/Jun/12 07:27 AM
SVN trunk uses FactoryStatistics to set the "name" (which is only relevant if using JMX anyway, so is irrelevant if null for non-JMX cases). And no, that code was not "full of bugs", just had a cut and paste on the class name to use in the name. Perhaps as your code must be so perfect you can just contribute a patch next time ... as the bug reporting guide asks.

Andy Jefferson made changes - 29/Jun/12 07:27 AM
Field Original Value New Value
Status Open [ 1 ] Resolved [ 5 ]
Fix Version/s 3.1.0.m5 [ 11595 ]
Resolution Fixed [ 1 ]
Andy Jefferson made changes - 06/Jul/12 10:00 AM
Status Resolved [ 5 ] Closed [ 6 ]