jhat OQL AND in where clause

2019-08-24 17:34发布

问题:

How to do a conjunction [AND] in jhat OQL where clause?

I want do this:

select s from sun.security.x509.X500Name s where  s.canonicalDn !=null and    
/tiberium/(s.canonicalDn.toString())

That is- I want to find all X500Names containing appTrust in their canonicaldn. I need the null check as some of canonicaldn can be null [and jhat throws a null pointer exception in that case at toString].

But literal "and" doesn't work.

BTW, I got around this for my purpose using filter function:

select filter(heap.objects("sun.security.x509.X500Name"), isTiberium);

function isTiberium(s) {  
    return s.canonicalDn !=null && /tiberium/(s.canonicalDn.toString());  
}

回答1:

I found out "and" is && as that is the javascript and operator. That is the correct expression is simply:

select s from sun.security.x509.X500Name s where  s.canonicalDn !=null &&    
/tiberium/(s.canonicalDn.toString())


标签: java jhat