Bug 1294010

Summary: [GSS](6.4.z) There is no query filter implementation in MBeanServerConnection
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Eiichi Nagai <enagai>
Component: JMXAssignee: Chao Wang <chaowan>
Status: CLOSED CURRENTRELEASE QA Contact: Peter Mackay <pmackay>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.4.5CC: bmaxwell, chaowan, hrupp, jtruhlar, msochure, pmackay, sdouglas
Target Milestone: CR1   
Target Release: EAP 6.4.11   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-01-17 13:08:03 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1361648    
Attachments:
Description Flags
reproducer none

Description Eiichi Nagai 2015-12-24 01:54:58 UTC
Created attachment 1109124 [details]
reproducer

Description of problem:
The query argument does not work with MBeanServerConnection#queryNames( https://docs.oracle.com/javase/7/docs/api/javax/management/MBeanServerConnection.html#queryNames%28javax.management.ObjectName,%20javax.management.QueryExp%29).

Version-Release number of selected component (if applicable):
EAP 6.4.5.

How reproducible:
Using MBeanServerConnection on EAP 6.

Steps to Reproduce:
1. Deploye test.war.
2. Execute "http://localhost:8080/test/test.jsp".

Actual results:
You can get all object by MBeanServerConnection#queryNames(null, query) even if it is set a QueryExp object as query argument.

- test.jsp.
~~
      QueryExp exp = Query.eq(Query.attr("test-attr"), Query.value("1234"));
      Set<ObjectName> names = mbsc.queryNames(null, exp);
~~

Expected results:
The query argument should have to be available in MBeanServerConnection.

Additional info:
As long as I checked source code of org.jboss.as.jmx.model.ModelControllerMBeanHelper.queryNames(ObjectName, QueryExp), there was no implementation for the query argument(It was TODO on source code).

- ModelControllerMBeanHelper#queryNames
~~~
    Set<ObjectName> queryNames(final ObjectName name, final QueryExp query) {
        return new RootResourceIterator<Set<ObjectName>>(accessControlUtil, getRootResourceAndRegistration().getResource(),
                new ObjectNameMatchResourceAction<Set<ObjectName>>(name) {

            Set<ObjectName> set = new HashSet<ObjectName>();

            @Override
            public boolean onResource(ObjectName resourceName) {
                if (name == null || name.apply(resourceName)) {
                    //TODO check query
                    set.add(resourceName);
                }
                return true;
            }

            @Override
            public Set<ObjectName> getResult() {
                if (set.size() == 1 && set.contains(ModelControllerMBeanHelper.createRootObjectName(domain))) {
                  return Collections.emptySet();
                }
                return set;
            }
        }).iterate();
~~~

Comment 2 JBoss JIRA Server 2016-01-04 20:13:30 UTC
Brian Stansberry <brian.stansberry> updated the status of jira WFCORE-1257 to Coding In Progress

Comment 4 Mike McCune 2016-03-28 22:24:40 UTC
This bug was accidentally moved from POST to MODIFIED via an error in automation, please see mmccune with any questions

Comment 5 Peter Mackay 2016-10-03 15:39:37 UTC
Verified with EAP 6.4.11.CP.CR1

Comment 6 Petr Penicka 2017-01-17 13:08:03 UTC
Retroactively bulk-closing issues from released EAP 6.4 cummulative patches.