use the standard JMX quote method when creating JMX names

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@356559 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Strachan 2005-12-13 18:15:36 +00:00
parent e73312534d
commit a558fef374
3 changed files with 8 additions and 4 deletions

View File

@ -65,7 +65,7 @@ public class ManagedRegionBroker extends RegionBroker {
// Build the object name for the destination // Build the object name for the destination
Hashtable map = new Hashtable(brokerObjectName.getKeyPropertyList()); Hashtable map = new Hashtable(brokerObjectName.getKeyPropertyList());
map.put("Type",destName.getDestinationTypeAsString()); map.put("Type",ObjectName.quote(destName.getDestinationTypeAsString()));
map.put("Destination", JMXSupport.encodeObjectNamePart(destName.getPhysicalName())); map.put("Destination", JMXSupport.encodeObjectNamePart(destName.getPhysicalName()));
ObjectName destObjectName= new ObjectName(brokerObjectName.getDomain(), map); ObjectName destObjectName= new ObjectName(brokerObjectName.getDomain(), map);
@ -77,7 +77,7 @@ public class ManagedRegionBroker extends RegionBroker {
public void unregister(ActiveMQDestination destName) throws Throwable { public void unregister(ActiveMQDestination destName) throws Throwable {
// Build the object name for the destination // Build the object name for the destination
Hashtable map = new Hashtable(brokerObjectName.getKeyPropertyList()); Hashtable map = new Hashtable(brokerObjectName.getKeyPropertyList());
map.put("Type",destName.getDestinationTypeAsString()); map.put("Type",ObjectName.quote(destName.getDestinationTypeAsString()));
map.put("Destination", JMXSupport.encodeObjectNamePart(destName.getPhysicalName())); map.put("Destination", JMXSupport.encodeObjectNamePart(destName.getPhysicalName()));
ObjectName destObjectName= new ObjectName(brokerObjectName.getDomain(), map); ObjectName destObjectName= new ObjectName(brokerObjectName.getDomain(), map);

View File

@ -115,8 +115,7 @@ public class ManagedTransportConnection extends TransportConnection {
// Build the object name for the destination // Build the object name for the destination
Hashtable map = new Hashtable(connectorName.getKeyPropertyList()); Hashtable map = new Hashtable(connectorName.getKeyPropertyList());
map.put("Type", "Connection"); map.put("Type", "Connection");
// lets avoid any JMX sensitive characters String jmxConnectionId = ObjectName.quote(connectionId);
String jmxConnectionId = connectionId.replace(':', '_');
map.put("Connection", jmxConnectionId); map.put("Connection", jmxConnectionId);
try { try {
return new ObjectName(connectorName.getDomain(), map); return new ObjectName(connectorName.getDomain(), map);

View File

@ -1,11 +1,16 @@
package org.activemq.util; package org.activemq.util;
import javax.management.ObjectName;
public class JMXSupport { public class JMXSupport {
static public String encodeObjectNamePart(String part) { static public String encodeObjectNamePart(String part) {
return ObjectName.quote(part);
/*
String answer = part.replaceAll("[\\:\\,\\'\\\"]", "_"); String answer = part.replaceAll("[\\:\\,\\'\\\"]", "_");
answer = answer.replaceAll("\\?", "&qe;"); answer = answer.replaceAll("\\?", "&qe;");
answer = answer.replaceAll("=", "&"); answer = answer.replaceAll("=", "&");
return answer; return answer;
*/
} }
} }