diff -ru jboss-4.0.2-src\jmx/src/main/org/jboss/mx/metadata/JBossXMBean10.java jboss-4.0.2-src-patch\jmx/src/main/org/jboss/mx/metadata/JBossXMBean10.java --- jboss-4.0.2-src\jmx/src/main/org/jboss/mx/metadata/JBossXMBean10.java 2004-10-31 17:06:24.000000000 -0200 +++ jboss-4.0.2-src-patch\jmx/src/main/org/jboss/mx/metadata/JBossXMBean10.java 2005-06-29 08:57:32.864345200 -0300 @@ -345,9 +345,17 @@ infos.add(info); } - // Add operations for get/setMethod that aren't already present - - for (Iterator it = attributes.iterator(); it.hasNext();) + /* + Add operations for get/setMethod that aren't already present + "In the JMX 1.2 specification, it is forbidden to call getters and + setters via invoke. Previously, an implementation was free to choose + whether or not to allow this. However, if the property jmx.invoke.getters + does not have an empty value, the code forbidding calling getters and + setters through invoke is disabled." + */ + String strGetters = System.getProperty("jmx.invoke.getters"); + boolean inkokeGetters = (strGetters != null) && (!"".equals(strGetters.trim())); + for (Iterator it = attributes.iterator(); (inkokeGetters && it.hasNext());) { Element attr = (Element) it.next(); String name = attr.elementTextTrim("name"); diff -ru jboss-4.0.2-src\jmx/src/main/org/jboss/mx/metadata/StandardMetaData.java jboss-4.0.2-src-patch\jmx/src/main/org/jboss/mx/metadata/StandardMetaData.java --- jboss-4.0.2-src\jmx/src/main/org/jboss/mx/metadata/StandardMetaData.java 2004-11-24 09:40:44.000000000 -0200 +++ jboss-4.0.2-src-patch\jmx/src/main/org/jboss/mx/metadata/StandardMetaData.java 2005-06-29 10:03:57.949895000 -0300 @@ -196,7 +196,17 @@ HashMap operInfo = new HashMap(); List attrInfo = new ArrayList(); - + + /* + Add operations for get/setMethod that aren't already present + "In the JMX 1.2 specification, it is forbidden to call getters and + setters via invoke. Previously, an implementation was free to choose + whether or not to allow this. However, if the property jmx.invoke.getters + does not have an empty value, the code forbidding calling getters and + setters through invoke is disabled." + */ + String strGetters = System.getProperty("jmx.invoke.getters"); + boolean inkokeGetters = (strGetters != null) && (!"".equals(strGetters.trim())); for (int i = 0; i < methods.length; ++i) { String methodName = methods[i].getName(); @@ -213,6 +223,9 @@ throw new IntrospectionException("overloaded type for attribute set: " + key); } setters.put(key, methods[i]); + if (!inkokeGetters) { + continue; + } } else if (methodName.startsWith("get") && methodName.length() > 3 && signature.length == 0 && returnType != Void.TYPE) @@ -224,6 +237,9 @@ throw new IntrospectionException("mixed use of get/is for attribute " + key); } getters.put(key, methods[i]); + if (!inkokeGetters) { + continue; + } } else if (methodName.startsWith("is") && methodName.length() > 2 && signature.length == 0 && isBooleanReturn(returnType)) @@ -235,12 +251,13 @@ throw new IntrospectionException("mixed use of get/is for attribute " + key); } getters.put(key, methods[i]); + if (!inkokeGetters) { + continue; + } } - else - { - MBeanOperationInfo info = new MBeanOperationInfo("MBean Operation.", methods[i]); - operInfo.put(getSignatureString(methods[i]), info); - } + + MBeanOperationInfo info = new MBeanOperationInfo("MBean Operation.", methods[i]); + operInfo.put(getSignatureString(methods[i]), info); } Object[] keys = getters.keySet().toArray();