Skip to content

Commit

Permalink
cluster names should be quoted (https://issues.jboss.org/browse/JGRP-…
Browse files Browse the repository at this point in the history
  • Loading branch information
belaban committed May 25, 2011
1 parent f9e6bed commit c3fe65f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/org/jgroups/jmx/JmxConfigurator.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public static void registerChannel(JChannel channel, MBeanServer server, String
if (cluster_name == null)
cluster_name = "null";

cluster_name=ObjectName.quote(cluster_name);

if (register_protocols) {
ProtocolStack stack = channel.getProtocolStack();
List<Protocol> protocols = stack.getProtocols();
Expand Down Expand Up @@ -90,6 +92,9 @@ public static void unregisterChannel(JChannel c, MBeanServer server, String clus
public static void unregisterChannel(JChannel c, MBeanServer server, String domain, String clusterName)
throws Exception {

if(clusterName != null)
clusterName=ObjectName.quote(clusterName);

ProtocolStack stack = c.getProtocolStack();
List<Protocol> protocols = stack.getProtocols();
for (Protocol p : protocols) {
Expand Down Expand Up @@ -197,19 +202,18 @@ private static void internalUnregister(Object obj, MBeanServer server, String na
}
}

private static ObjectName getObjectName(Object obj, String name)
throws MalformedObjectNameException {
private static ObjectName getObjectName(Object obj, String name) throws MalformedObjectNameException {
MBean resource = obj.getClass().getAnnotation(MBean.class);
if (name != null && name.length() > 0) {
return new ObjectName(name);
} else if (resource.objectName() != null && resource.objectName().length() > 0) {
return new ObjectName(resource.objectName());
} else {
throw new MalformedObjectNameException("Instance " + obj + " of a class "
+ obj.getClass() + " does not have a valid object name");
throw new MalformedObjectNameException(obj + " of class " + obj.getClass() + " has an invalid object name");
}
}


/**
* Unregisters object_name and everything under it
*
Expand Down

0 comments on commit c3fe65f

Please sign in to comment.