Mantis - Resin
Viewing Issue Advanced Details
6041 minor always 03-17-17 09:04 04-24-17 15:32
kpokrovsky  
ferg  
normal  
closed  
fixed  
none    
none 4.0.52  
0006041: com.caucho.jmx.MBeanView does not match wildcard queries
log4j2 can't reload mbeand due to that, because resin's mbean server can't unlink old beans.

265: private boolean isMatch(ObjectName name, ObjectName queryName, QueryExp query):
...
    if (queryName.isPropertyPattern()) {
      // If the queryName has a '*' in the properties, then check
      // the queryName properties to see if they match

      Hashtable<String,String> map = queryName.getKeyPropertyList();
      Iterator<String> iter = map.keySet().iterator();
      while (iter.hasNext()) {
        String key = iter.next();
        String value = map.get(key);

        if (! value.equals(name.getKeyProperty(key)))
          return false;
      }
    }
...

The comment is correct. But why equals on value?! No wildcard matching actually happens just plain string comparison.
Correct would be:

if (! name.getKeyProperty(key).matches(value.replace("?", ".?").replace("*", ".*?")))
          return false;
Configure log4j2 in a web project and try to reload config using JMX. You will see an exception saying that Resin can't register log4j2 beans because they already exist.

Notes
(0006748)
ferg   
04-24-17 15:32   
env/0119