From: <ls...@us...> - 2007-01-07 08:22:29
|
Revision: 3000 http://jnode.svn.sourceforge.net/jnode/?rev=3000&view=rev Author: lsantha Date: 2007-01-07 00:22:28 -0800 (Sun, 07 Jan 2007) Log Message: ----------- Classpath patches. Modified Paths: -------------- trunk/core/src/classpath/javax/javax/management/AttributeList.java trunk/core/src/classpath/javax/javax/management/MBeanAttributeInfo.java trunk/core/src/classpath/javax/javax/management/MBeanConstructorInfo.java trunk/core/src/classpath/javax/javax/management/MBeanOperationInfo.java trunk/core/src/classpath/javax/javax/management/MBeanServerDelegate.java trunk/core/src/classpath/javax/javax/management/MBeanServerFactory.java trunk/core/src/classpath/javax/javax/management/ObjectName.java trunk/core/src/classpath/javax/javax/management/StandardMBean.java Modified: trunk/core/src/classpath/javax/javax/management/AttributeList.java =================================================================== --- trunk/core/src/classpath/javax/javax/management/AttributeList.java 2007-01-07 08:19:52 UTC (rev 2999) +++ trunk/core/src/classpath/javax/javax/management/AttributeList.java 2007-01-07 08:22:28 UTC (rev 3000) @@ -49,7 +49,7 @@ * @since 1.5 */ public class AttributeList - extends ArrayList + extends ArrayList<Object> { /** Modified: trunk/core/src/classpath/javax/javax/management/MBeanAttributeInfo.java =================================================================== --- trunk/core/src/classpath/javax/javax/management/MBeanAttributeInfo.java 2007-01-07 08:19:52 UTC (rev 2999) +++ trunk/core/src/classpath/javax/javax/management/MBeanAttributeInfo.java 2007-01-07 08:22:28 UTC (rev 3000) @@ -38,6 +38,7 @@ package javax.management; import java.lang.reflect.Method; +import java.lang.reflect.Type; /** * Describes the attributes of a management bean. @@ -109,13 +110,21 @@ "not be null."); if (getter == null) { - attributeType = setter.getParameterTypes()[0].getName(); + Type t = setter.getGenericParameterTypes()[0]; + if (t instanceof Class) + attributeType = ((Class) t).getName(); + else + attributeType = t.toString(); isRead = false; is = false; } else { - attributeType = getter.getReturnType().getName(); + Type t = getter.getGenericReturnType(); + if (t instanceof Class) + attributeType = ((Class) t).getName(); + else + attributeType = t.toString(); isRead = true; is = getter.getName().startsWith("is"); } Modified: trunk/core/src/classpath/javax/javax/management/MBeanConstructorInfo.java =================================================================== --- trunk/core/src/classpath/javax/javax/management/MBeanConstructorInfo.java 2007-01-07 08:19:52 UTC (rev 2999) +++ trunk/core/src/classpath/javax/javax/management/MBeanConstructorInfo.java 2007-01-07 08:22:28 UTC (rev 3000) @@ -38,6 +38,7 @@ package javax.management; import java.lang.reflect.Constructor; +import java.lang.reflect.Type; import java.util.Arrays; @@ -77,12 +78,18 @@ public MBeanConstructorInfo(String desc, Constructor cons) { super(cons.getName(), desc); - Class[] paramTypes = cons.getParameterTypes(); + Type[] paramTypes = cons.getGenericParameterTypes(); signature = new MBeanParameterInfo[paramTypes.length]; for (int a = 0; a < paramTypes.length; ++a) + { + Type t = paramTypes[a]; + if (t instanceof Class) signature[a] = new MBeanParameterInfo(null, - paramTypes[a].getName(), + ((Class) t).getName(), null); + else + signature[a] = new MBeanParameterInfo(null, t.toString(), null); + } } /** Modified: trunk/core/src/classpath/javax/javax/management/MBeanOperationInfo.java =================================================================== --- trunk/core/src/classpath/javax/javax/management/MBeanOperationInfo.java 2007-01-07 08:19:52 UTC (rev 2999) +++ trunk/core/src/classpath/javax/javax/management/MBeanOperationInfo.java 2007-01-07 08:22:28 UTC (rev 3000) @@ -38,6 +38,7 @@ package javax.management; import java.lang.reflect.Method; +import java.lang.reflect.Type; import java.util.Arrays; @@ -113,13 +114,23 @@ public MBeanOperationInfo(String desc, Method method) { super(method.getName(), desc); - Class[] paramTypes = method.getParameterTypes(); + Type[] paramTypes = method.getGenericParameterTypes(); signature = new MBeanParameterInfo[paramTypes.length]; for (int a = 0; a < paramTypes.length; ++a) + { + Type t = paramTypes[a]; + if (t instanceof Class) signature[a] = new MBeanParameterInfo(null, - paramTypes[a].getName(), + ((Class) t).getName(), null); - type = method.getReturnType().getName(); + else + signature[a] = new MBeanParameterInfo(null, t.toString(), null); + } + Type retType = method.getGenericReturnType(); + if (retType instanceof Class) + type = ((Class) retType).getName(); + else + type = retType.toString(); if (method.getReturnType() == Void.TYPE) { if (paramTypes.length == 0) Modified: trunk/core/src/classpath/javax/javax/management/MBeanServerDelegate.java =================================================================== --- trunk/core/src/classpath/javax/javax/management/MBeanServerDelegate.java 2007-01-07 08:19:52 UTC (rev 2999) +++ trunk/core/src/classpath/javax/javax/management/MBeanServerDelegate.java 2007-01-07 08:22:28 UTC (rev 3000) @@ -69,7 +69,7 @@ /** * The listeners registered with the delegate. */ - private List listeners; + private final List listeners = new ArrayList(); /** * The sequence identifier used by the delegate. @@ -120,8 +120,6 @@ { if (listener == null) throw new IllegalArgumentException("A null listener was supplied."); - if (listeners == null) - listeners = new ArrayList(); listeners.add(new ListenerData(listener, filter, passback)); } Modified: trunk/core/src/classpath/javax/javax/management/MBeanServerFactory.java =================================================================== --- trunk/core/src/classpath/javax/javax/management/MBeanServerFactory.java 2007-01-07 08:19:52 UTC (rev 2999) +++ trunk/core/src/classpath/javax/javax/management/MBeanServerFactory.java 2007-01-07 08:22:28 UTC (rev 3000) @@ -89,7 +89,7 @@ /** * The map of registered servers (identifiers to servers). */ - private static Map servers; + private static final Map servers = new HashMap(); /** * Private constructor to prevent instance creation. @@ -154,10 +154,10 @@ */ public static MBeanServer createMBeanServer(String domain) { - /* FIXME: Check for permission "createMBeanServer" */ + SecurityManager sm = System.getSecurityManager(); + if (sm != null) + sm.checkPermission(new MBeanServerPermission("createMBeanServer")); MBeanServer server = createServer(domain); - if (servers == null) - servers = new HashMap(); try { ObjectName dn = new @@ -208,7 +208,9 @@ */ public static ArrayList findMBeanServer(String id) { - /* FIXME: Check for permission "findMBeanServer" */ + SecurityManager sm = System.getSecurityManager(); + if (sm != null) + sm.checkPermission(new MBeanServerPermission("findMBeanServer")); if (id == null) return new ArrayList(servers.values()); ArrayList list = new ArrayList(); @@ -297,7 +299,9 @@ */ public static MBeanServer newMBeanServer(String domain) { - /* FIXME: Check for permission "newMBeanServer" */ + SecurityManager sm = System.getSecurityManager(); + if (sm != null) + sm.checkPermission(new MBeanServerPermission("newMBeanServer")); return createServer(domain); } @@ -330,7 +334,8 @@ builder.getClass() != MBeanServerBuilder.class) builder = new MBeanServerBuilder(); } - else if (!(builderClass.equals(builder.getClass().getName()))) + else if (!(builder != null && + builderClass.equals(builder.getClass().getName()))) { ClassLoader cl = Thread.currentThread().getContextClassLoader(); if (cl == null) @@ -387,7 +392,9 @@ */ public static void releaseMBeanServer(MBeanServer server) { - /* FIXME: Check for permission "releaseMBeanServer" */ + SecurityManager sm = System.getSecurityManager(); + if (sm != null) + sm.checkPermission(new MBeanServerPermission("releaseMBeanServer")); Iterator i = servers.values().iterator(); while (i.hasNext()) { Modified: trunk/core/src/classpath/javax/javax/management/ObjectName.java =================================================================== --- trunk/core/src/classpath/javax/javax/management/ObjectName.java 2007-01-07 08:19:52 UTC (rev 2999) +++ trunk/core/src/classpath/javax/javax/management/ObjectName.java 2007-01-07 08:22:28 UTC (rev 3000) @@ -565,16 +565,15 @@ /** * Returns the properties in a {@link java.util.Hashtable}. The table * contains each of the properties as keys mapped to their value. The - * returned table may be unmodifiable. If the case that the table is - * modifiable, changes made to it will not be reflected in the object - * name. + * returned table is not unmodifiable, but changes made to it will not + * be reflected in the object name. * * @return a {@link java.util.Hashtable}, containing each of the object * name's properties. */ public Hashtable getKeyPropertyList() { - return (Hashtable) Collections.unmodifiableMap(new Hashtable(properties)); + return new Hashtable(properties); } /** Modified: trunk/core/src/classpath/javax/javax/management/StandardMBean.java =================================================================== --- trunk/core/src/classpath/javax/javax/management/StandardMBean.java 2007-01-07 08:19:52 UTC (rev 2999) +++ trunk/core/src/classpath/javax/javax/management/StandardMBean.java 2007-01-07 08:22:28 UTC (rev 3000) @@ -665,7 +665,10 @@ ainfo, cinfo, oinfo, null); String cname = getClassName(info); String desc = getDescription(info); - info = new MBeanInfo(cname, desc, ainfo, cinfo, oinfo, null); + MBeanNotificationInfo[] ninfo = null; + if (impl instanceof NotificationBroadcaster) + ninfo = ((NotificationBroadcaster) impl).getNotificationInfo(); + info = new MBeanInfo(cname, desc, ainfo, cinfo, oinfo, ninfo); cacheMBeanInfo(info); return info; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |