Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 330074 - null returns from SnapshotImpl methods
Summary: null returns from SnapshotImpl methods
Status: RESOLVED FIXED
Alias: None
Product: MAT
Classification: Tools
Component: Core (show other bugs)
Version: 1.1   Edit
Hardware: All All
: P3 minor (vote)
Target Milestone: 1.11.0   Edit
Assignee: Andrew Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-12 06:32 EST by Andrew Johnson CLA
Modified: 2020-09-30 03:11 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Johnson CLA 2010-11-12 06:32:08 EST
These methods can return null:

getClassesByName(String name, boolean includeSubClasses)
getHistogram(int[] objectIds, IProgressListener progressMonitor)
getInboundRefererIds(int[] objectIds, IProgressListener progressMonitor)

Should they be able to return null?
If so, do all uses check for null?
Comment 1 Andrew Johnson CLA 2011-06-02 05:46:23 EDT
Problem with CollectionFillRatio and and unknown -collection object

collections_grouped_by_size .*  -collection notfound -size_attribute notfound

java.lang.NullPointerException
at org.eclipse.mat.inspections.collections.CollectionsBySizeQuery.execute(CollectionsBySizeQuery.java:80)
at org.eclipse.mat.query.registry.ArgumentSet.execute(ArgumentSet.java:129)
at org.eclipse.mat.ui.QueryExecution$ExecutionJob.run(QueryExecution.java:174)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Comment 2 Jonathan Lawrence CLA 2012-03-23 12:48:17 EDT
All uses do not check for null.  Here's an example:

java.lang.NullPointerException
    at org.eclipse.mat.inspections.component.ComponentReportQuery.addOverviewNumbers(ComponentReportQuery.java:276)
    at org.eclipse.mat.inspections.component.ComponentReportQuery.addOverview(ComponentReportQuery.java:262)
    at org.eclipse.mat.inspections.component.ComponentReportQuery.execute(ComponentReportQuery.java:94)
    at org.eclipse.mat.query.registry.ArgumentSet.execute(ArgumentSet.java:129)
    at org.eclipse.mat.snapshot.query.SnapshotQuery.execute(SnapshotQuery.java:192)
    at org.eclipse.mat.inspections.component.TopComponentsReportQuery.execute(TopComponentsReportQuery.java:67)
    at org.eclipse.mat.query.registry.ArgumentSet.execute(ArgumentSet.java:129)
    at org.eclipse.mat.query.registry.CommandLine.execute(CommandLine.java:93)
    at org.eclipse.mat.report.internal.QueryPart.execute(QueryPart.java:96)
    at org.eclipse.mat.report.TestSuite.execute(TestSuite.java:138)
    at org.eclipse.mat.report.internal.RunRegisterdReport.execute(RunRegisterdReport.java:60)
    at org.eclipse.mat.query.registry.ArgumentSet.execute(ArgumentSet.java:129)
    at org.eclipse.mat.ui.QueryExecution$ExecutionJob.run(QueryExecution.java:176)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

The above could have been caused by the user cancelling the progress monitor during an earlier getHistogram(int[] objectIds, IProgressListener progressMonitor) call.
Comment 3 Andrew Johnson CLA 2014-05-12 07:43:22 EDT
I've checked that calls to those methods now check the return for null.
Comment 4 Eclipse Genie CLA 2020-02-17 11:05:59 EST
New Gerrit change created: https://git.eclipse.org/r/157849
Comment 6 Eclipse Genie CLA 2020-06-17 06:21:22 EDT
New Gerrit change created: https://git.eclipse.org/r/165041
Comment 8 Andrew Johnson CLA 2020-06-17 06:56:51 EDT
Let's close this one now as we have fixed all the problems we can see.