Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Memory Analyzer » OQL: Why is the returned object not a String but "com.ibm.wps.state.keymanager.ValueImpl"?(OQL question on type of returned object type)
OQL: Why is the returned object not a String but "com.ibm.wps.state.keymanager.ValueImpl"? [message #1827958] Wed, 27 May 2020 16:19 Go to next message
Hermann Huebler is currently offline Hermann HueblerFriend
Messages: 3
Registered: February 2020
Junior Member
I'm runnin the following OQL in MAT 1.9.2:

--- snip ---
SELECT x.data.toString() FROM INSTANCEOF "com.ibm.wps.state.keymanager.ValueImpl" x WHERE ((dominatorof(x) != null) and (classof(dominatorof(x)).@name = "com.ibm.wps.util.BidiMapImpl") and (toHex(dominatorof(x).@objectAddress).toString() = "0x6985397b0"))
--- snip ---

and get the expected number of objects back. However the returned objects are not of type String (as I'd expect because of the .toString()) function but ValueImpl. This because if I click on the result I get the attributes of the ValueImpl objects (which are char[] data. int hash) shown and if I try to extract a substring from the selected data I get the following error:

--- snip ---
Executed Query:
SELECT substr(x.data.toString(), 1, 32) FROM INSTANCEOF "com.ibm.wps.state.keymanager.ValueImpl" x WHERE ((dominatorof(x) != null) and (classof(dominatorof(x)).@name = "com.ibm.wps.util.BidiMapImpl") and (toHex(dominatorof(x).@objectAddress).toString() = "0x6985397b0"))

Problem reported:
Method substr(java.lang.String, int, int) not found in object com.ibm.wps.state.keymanager.ValueImpl [id=0x76a7e0c00] of type org.eclipse.mat.parser.model.InstanceImpl
--- snip ---

why does x.data.toString() return a String type here?

Thanks for any advise - Hermann
Re: OQL: Why is the returned object not a String but "com.ibm.wps.state.keymanager.ValueImpl&qu [message #1828026 is a reply to message #1827958] Fri, 29 May 2020 11:27 Go to previous message
Andrew Johnson is currently offline Andrew JohnsonFriend
Messages: 205
Registered: July 2009
Senior Member
I think that's expected.
The row holds the object from the FROM claus (whatever x is).
The select item is what is displayed in that column.

If you try
SELECT x,x.value,x.value.toString() FROM INSTANCEOF java.util.HashMap$Entry x WHERE ((dominatorof(x) != null) and (classof(dominatorof(x)).@name = "java.util.HashMap$Entry[]"))

then this has 3 columns, x, x.value (both MAT IObjects) and x.value.toString() (a Java String).

If you used Memory Analyzer 1.10.0 which has some OQL improvements, then the context menu for each row has:

SELECT ... x
x
x.value

SELECT ... x gives a context menu on the row object, and 'COPY OQL' copies to the clipboard a new OQL query for the whole of that row.
x gives a context menu on the select item x IObject, and 'COPY OQL' copies to the clipboard a new OQL query for that single column of that row.
x.value gives a context menu on the select item x.value IObject, and 'COPY OQL' copies to the clipboard a new OQL query for that single column of that row.
Previous Topic:DTFJ Error Opening Core Dump
Next Topic:OOM error Finalizer
Goto Forum:
  


Current Time: Wed Feb 05 18:04:30 GMT 2025

Powered by FUDForum. Page generated in 0.02792 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top