Community
Participate
Working Groups
Modifying overview.xml with <query name="%overview.system_properties"> <param key="format" value="csv" /> and running it on a PHD gives java.lang.NullPointerException at org.eclipse.mat.report.internal.HtmlOutputter.process(HtmlOutputter.java:88) at org.eclipse.mat.report.internal.ResultRenderer.doProcessAlien(ResultRenderer.java:274) at org.eclipse.mat.report.internal.ResultRenderer.process(ResultRenderer.java:240) at org.eclipse.mat.report.internal.QueryPart.execute(QueryPart.java:160) at org.eclipse.mat.report.internal.SectionPart.execute(SectionPart.java:53) at org.eclipse.mat.report.TestSuite.execute(TestSuite.java:131) at org.eclipse.mat.report.internal.RunExternalTest.execute(RunExternalTest.java:39) 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) Is null an acceptable return from a query? The GUI says "Query did not return any result".
This can also be demonstrated by running the regression.xml report from a development version of MAT with the org.eclipse.mat.test plugin loaded. doProcess will chose another outputter if required, but in this case will leave it as HtmlOutputter as we do not know which type to use for a null result. The easiest solution is to change ResultRenderer.process() to call doProcess if the outputter is HtmlOutputter rather than if the type is "html" as the alternative of doProcessAlien will always fail if the outputter is actually HtmlOutputter.
We also should consider what happens if a new outputter of type "html" is created to handle a specific type of output. @Renderer(target = "html", result = IResultTree.class) public class HtmlOutputter2 extends HtmlOutputter { public void embedd(Context context, IResult result, Writer writer) throws IOException { writer.append("<p>A special table</p>"); super.embedd(context, result, writer); } } We don't want to use doProcessAlien for these as we want it all embedded in the same report. The test therefore is: if ("html".equals(format) || outputter.equals(html)) //$NON-NLS-1$
The fix solved the problem.