Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 318635 - NullPointerException in QueryContextImpl.convertToValue
Summary: NullPointerException in QueryContextImpl.convertToValue
Status: RESOLVED FIXED
Alias: None
Product: MAT
Classification: Tools
Component: GUI (show other bugs)
Version: 1.0   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-01 12:16 EDT by Andrew Johnson CLA
Modified: 2010-07-05 08:16 EDT (History)
0 users

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-07-01 12:16:50 EDT
If you open a dump with an UnreachableObjectsHistogram, run the Unreachable Objects Histogram query, then open a dump without the UnreachableObjectsHistogram, then bring up the query browser with control-Q then select the UnreachableObjectsHistogram from the history then a query dialog appears. Typing anything into the -histogram field gives 

Event loop exception
java.lang.NullPointerException
    at org.eclipse.mat.query.registry.QueryContextImpl.convertToValue(QueryContextImpl.java:44)
    at org.eclipse.mat.internal.snapshot.SnapshotQueryContext.convertToValue(SnapshotQueryContext.java:183)
    at org.eclipse.mat.ui.internal.query.arguments.TextEditor.editingDone(TextEditor.java:154)
    at org.eclipse.mat.ui.internal.query.arguments.TextEditor$2.modifyText(TextEditor.java:120)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:167)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
Comment 1 Andrew Johnson CLA 2010-07-01 12:20:16 EDT
The main problem is that queries are shown in the history which are not valid and are not satisfiable by that dump. There is no converter available to convert a String from the user into the UnreachableObjectsHistogram.

The error message could be slightly better.

Main fix:
Ensure the QueryHistoryProvider doesn't return unsuitable queries.

Also give a better error message if for some reason an unsuitable query is somehow selected.
Comment 2 Andrew Johnson CLA 2010-07-01 16:34:11 EDT
Fix has now been applied.

It is still possible to run the query on a dump without an Unreachable Objects Histogram by typing 

control-Q
unreachable_objects

This gives an error message in the dialog of

 java.lang.IllegalArgumentException: org.eclipse.mat.snapshot.UnreachableObjectsHistogram

This is not very helpful.

Would this be better?

 Impossible to convert any string to org.eclipse.mat.snapshot.UnreachableObjectsHistogram, query is not suitable for this snapshot
Comment 3 Andrew Johnson CLA 2010-07-05 08:16:09 EDT
Error message is now:

 Impossible to convert any string to org.eclipse.mat.snapshot.UnreachableObjectsHistogram, query is not suitable for this snapshot