environment) {
ClassLoader loader = null;
if (environment != null) {
diff --git a/src/share/classes/javax/management/remote/rmi/NoCallStackClassLoader.java b/src/share/classes/javax/management/remote/rmi/NoCallStackClassLoader.java
index a4c5fe0eadf47097e081213234d4290310b662be..5c2970f2116c9b922af1ec1f6fe99a2563ae2cc5 100644
--- a/src/share/classes/javax/management/remote/rmi/NoCallStackClassLoader.java
+++ b/src/share/classes/javax/management/remote/rmi/NoCallStackClassLoader.java
@@ -118,7 +118,8 @@ class NoCallStackClassLoader extends ClassLoader {
* if it is one of the classes whose byte code we have, or
* delegate the load if it is one of the referenced classes.
*/
- protected Class findClass(String name) throws ClassNotFoundException {
+ @Override
+ protected Class> findClass(String name) throws ClassNotFoundException {
for (int i = 0; i < classNames.length; i++) {
if (name.equals(classNames[i])) {
return defineClass(classNames[i], byteCodes[i], 0,
diff --git a/src/share/classes/javax/management/remote/rmi/RMIConnection.java b/src/share/classes/javax/management/remote/rmi/RMIConnection.java
index 863b3dca8cccf9ce282e4778ff7489d2bf540747..6fbafdb531a52be8d3e3f4f71cb8c9ebff912cd5 100644
--- a/src/share/classes/javax/management/remote/rmi/RMIConnection.java
+++ b/src/share/classes/javax/management/remote/rmi/RMIConnection.java
@@ -31,7 +31,6 @@ import java.rmi.MarshalledObject;
import java.rmi.Remote;
import java.util.Set;
-import javax.management.Attribute;
import javax.management.AttributeList;
import javax.management.AttributeNotFoundException;
import javax.management.InstanceAlreadyExistsException;
@@ -45,11 +44,11 @@ import javax.management.MBeanRegistrationException;
import javax.management.MBeanServerConnection;
import javax.management.NotCompliantMBeanException;
-import javax.management.NotificationFilter;
import javax.management.ObjectInstance;
import javax.management.ObjectName;
-import javax.management.QueryExp;
import javax.management.ReflectionException;
+import javax.management.RuntimeMBeanException;
+import javax.management.RuntimeOperationsException;
import javax.management.remote.NotificationResult;
import javax.security.auth.Subject;
@@ -89,8 +88,9 @@ import javax.security.auth.Subject;
* even though it would add useful information to the documentation. The
* reason is that it was only added in Mustang (Java SE 6), whereas versions
* 1.4 and 2.0 of the JMX API must be implementable on Tiger per our
- * commitments for JSR 255.
+ * commitments for JSR 255. This is also why we suppress rawtypes warnings.
*/
+@SuppressWarnings("rawtypes")
public interface RMIConnection extends Closeable, Remote {
/**
* Returns the connection ID. This string is different for
diff --git a/src/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java b/src/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java
index a87d146e94ef2b52b1a7023929cf4ae707354354..acac5ec8f22c17ac26da3eaef9f55ddc06ebde7e 100644
--- a/src/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java
+++ b/src/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java
@@ -308,6 +308,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
}
}
+ @SuppressWarnings("rawtypes") // MarshalledObject
public ObjectInstance createMBean(String className,
ObjectName name,
MarshalledObject params,
@@ -368,6 +369,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
}
}
+ @SuppressWarnings("rawtypes") // MarshalledObject
public ObjectInstance createMBean(String className,
ObjectName name,
ObjectName loaderName,
@@ -493,6 +495,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
}
}
+ @SuppressWarnings("rawtypes") // MarshalledObject
public Set
queryMBeans(ObjectName name,
MarshalledObject query,
@@ -527,6 +530,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
}
}
+ @SuppressWarnings("rawtypes") // MarshalledObject
public Set
queryNames(ObjectName name,
MarshalledObject query,
@@ -668,6 +672,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
}
}
+ @SuppressWarnings("rawtypes") // MarshalledObject
public void setAttribute(ObjectName name,
MarshalledObject attribute,
Subject delegationSubject)
@@ -720,6 +725,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
}
}
+ @SuppressWarnings("rawtypes") // MarshalledObject
public AttributeList setAttributes(ObjectName name,
MarshalledObject attributes,
Subject delegationSubject)
@@ -765,6 +771,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
}
}
+ @SuppressWarnings("rawtypes") // MarshalledObject
public Object invoke(ObjectName name,
String operationName,
MarshalledObject params,
@@ -928,6 +935,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
}
}
+ @SuppressWarnings("rawtypes") // MarshalledObject
public Integer[] addNotificationListeners(ObjectName[] names,
MarshalledObject[] filters,
Subject[] delegationSubjects)
@@ -1013,6 +1021,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
}
}
+ @SuppressWarnings("rawtypes") // MarshalledObject
public void addNotificationListener(ObjectName name,
ObjectName listener,
MarshalledObject filter,
@@ -1148,6 +1157,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
}
}
+ @SuppressWarnings("rawtypes") // MarshalledObject
public void removeNotificationListener(ObjectName name,
ObjectName listener,
MarshalledObject filter,
@@ -1809,7 +1819,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
}
}
- private static T unwrap(final MarshalledObject mo,
+ private static T unwrap(final MarshalledObject> mo,
final ClassLoader cl,
final Class wrappedClass)
throws IOException {
@@ -1847,7 +1857,7 @@ public class RMIConnectionImpl implements RMIConnection, Unreferenced {
return null;
}
- private static T unwrap(final MarshalledObject mo,
+ private static T unwrap(final MarshalledObject> mo,
final ClassLoader cl1,
final ClassLoader cl2,
final Class wrappedClass)
diff --git a/src/share/classes/javax/management/remote/rmi/RMIConnector.java b/src/share/classes/javax/management/remote/rmi/RMIConnector.java
index 934dac790db9a9dc334094a0406dd788a88461fa..1f17143b9486a70bcdbfba079181d8fdb6945f3b 100644
--- a/src/share/classes/javax/management/remote/rmi/RMIConnector.java
+++ b/src/share/classes/javax/management/remote/rmi/RMIConnector.java
@@ -28,6 +28,7 @@ package javax.management.remote.rmi;
import com.sun.jmx.event.DaemonThreadFactory;
import com.sun.jmx.event.EventConnection;
import com.sun.jmx.mbeanserver.PerThreadGroupPool;
+import com.sun.jmx.mbeanserver.Util;
import com.sun.jmx.remote.internal.ClientCommunicatorAdmin;
import com.sun.jmx.remote.internal.ClientListenerInfo;
import com.sun.jmx.remote.internal.ClientNotifForwarder;
@@ -584,7 +585,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
// added for re-connection
private Integer addListenerWithSubject(ObjectName name,
- MarshalledObject filter,
+ MarshalledObject filter,
Subject delegationSubject,
boolean reconnect)
throws InstanceNotFoundException, IOException {
@@ -595,7 +596,8 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
"(ObjectName,MarshalledObject,Subject)");
final ObjectName[] names = new ObjectName[] {name};
- final MarshalledObject[] filters = new MarshalledObject[] {filter};
+ final MarshalledObject[] filters =
+ Util.cast(new MarshalledObject>[] {filter});
final Subject[] delegationSubjects = new Subject[] {
delegationSubject
};
@@ -611,7 +613,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
// added for re-connection
private Integer[] addListenersWithSubjects(ObjectName[] names,
- MarshalledObject[] filters,
+ MarshalledObject[] filters,
Subject[] delegationSubjects,
boolean reconnect)
throws InstanceNotFoundException, IOException {
@@ -1362,7 +1364,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
//--------------------------------------------------------------------
private class RMINotifClient extends ClientNotifForwarder {
- public RMINotifClient(ClassLoader cl, Map env) {
+ public RMINotifClient(ClassLoader cl, Map env) {
super(cl, env);
}
@@ -1444,8 +1446,8 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
Integer[] listenerIDs;
final ObjectName[] names =
new ObjectName[] {MBeanServerDelegate.DELEGATE_NAME};
- final MarshalledObject[] filters =
- new MarshalledObject[] {sFilter};
+ final MarshalledObject[] filters =
+ Util.cast(new MarshalledObject>[] {sFilter});
final Subject[] subjects = new Subject[] {null};
try {
listenerIDs =
@@ -1580,7 +1582,8 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
final ObjectName[] names = new ObjectName[len];
final NotificationListener[] listeners = new NotificationListener[len];
final NotificationFilter[] filters = new NotificationFilter[len];
- final MarshalledObject[] mFilters = new MarshalledObject[len];
+ final MarshalledObject[] mFilters =
+ Util.cast(new MarshalledObject>[len]);
final Object[] handbacks = new Object[len];
for (i=0;i environment)
throws IOException {
if (rmiServer instanceof javax.rmi.CORBA.Stub) {
javax.rmi.CORBA.Stub stub = (javax.rmi.CORBA.Stub) rmiServer;
@@ -1776,7 +1779,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
* does not point to an {@link org.omg.CORBA.ORB ORB}.
* @exception IOException if the ORB initialization failed.
**/
- static ORB resolveOrb(Map environment)
+ static ORB resolveOrb(Map environment)
throws IOException {
if (environment != null) {
final Object orb = environment.get(EnvHelp.DEFAULT_ORB);
@@ -2004,7 +2007,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
}
}
- private RMIServer findRMIServerIIOP(String ior, Map env, boolean isIiop) {
+ private RMIServer findRMIServerIIOP(String ior, Map env, boolean isIiop) {
// could forbid "rmi:" URL here -- but do we need to?
final ORB orb = (ORB)
env.get(EnvHelp.DEFAULT_ORB);
@@ -2012,7 +2015,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
return (RMIServer) PortableRemoteObject.narrow(stub, RMIServer.class);
}
- private RMIServer findRMIServerJRMP(String base64, Map env, boolean isIiop)
+ private RMIServer findRMIServerJRMP(String base64, Map env, boolean isIiop)
throws IOException {
// could forbid "iiop:" URL here -- but do we need to?
final byte[] serialized;
@@ -2046,7 +2049,8 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
this.loader = cl;
}
- protected Class resolveClass(ObjectStreamClass classDesc)
+ @Override
+ protected Class> resolveClass(ObjectStreamClass classDesc)
throws IOException, ClassNotFoundException {
return Class.forName(classDesc.getName(), false, loader);
}
@@ -2121,13 +2125,13 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
private static final String rmiServerImplStubClassName =
RMIServer.class.getName() + "Impl_Stub";
- private static final Class rmiServerImplStubClass;
+ private static final Class> rmiServerImplStubClass;
private static final String rmiConnectionImplStubClassName =
RMIConnection.class.getName() + "Impl_Stub";
private static final Class> rmiConnectionImplStubClass;
private static final String pRefClassName =
"com.sun.jmx.remote.internal.PRef";
- private static final Constructor proxyRefConstructor;
+ private static final Constructor> proxyRefConstructor;
static {
final String pRefByteCodeString =
"\312\376\272\276\0\0\0.\0\27\12\0\5\0\15\11\0\4\0\16\13\0\17\0"+
@@ -2162,7 +2166,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
}
};
- Class serverStubClass;
+ Class> serverStubClass;
try {
serverStubClass = Class.forName(rmiServerImplStubClassName);
} catch (Exception e) {
@@ -2175,10 +2179,10 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
rmiServerImplStubClass = serverStubClass;
Class> stubClass;
- Constructor constr;
+ Constructor> constr;
try {
stubClass = Class.forName(rmiConnectionImplStubClassName);
- constr = (Constructor) AccessController.doPrivileged(action);
+ constr = (Constructor>) AccessController.doPrivileged(action);
} catch (Exception e) {
logger.error("",
"Failed to initialize proxy reference constructor "+
@@ -2198,9 +2202,8 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
RemoteRef ref = stub.getRef();
RemoteRef proxyRef = (RemoteRef)
proxyRefConstructor.newInstance(new Object[] {ref});
- final Class[] constrTypes = {RemoteRef.class};
- final Constructor rmiConnectionImplStubConstructor =
- rmiConnectionImplStubClass.getConstructor(constrTypes);
+ final Constructor> rmiConnectionImplStubConstructor =
+ rmiConnectionImplStubClass.getConstructor(RemoteRef.class);
Object[] args = {proxyRef};
RMIConnection proxyStub = (RMIConnection)
rmiConnectionImplStubConstructor.newInstance(args);
@@ -2328,7 +2331,7 @@ public class RMIConnector implements JMXConnector, Serializable, JMXAddressable
"com.sun.jmx.remote.internal.ProxyStub";
private static final String pInputStreamClassName =
"com.sun.jmx.remote.internal.PInputStream";
- private static final Class proxyStubClass;
+ private static final Class> proxyStubClass;
static {
final String proxyStubByteCodeString =
"\312\376\272\276\0\0\0.\0)\12\0\14\0\26\7\0\27\12\0\14\0\30\12"+
diff --git a/src/share/classes/javax/management/remote/rmi/RMIConnectorServer.java b/src/share/classes/javax/management/remote/rmi/RMIConnectorServer.java
index 2cbe315bfdd1115983a23b73069f86ba2b212a59..e56020b472223609231c9b947df94184ca9a9759 100644
--- a/src/share/classes/javax/management/remote/rmi/RMIConnectorServer.java
+++ b/src/share/classes/javax/management/remote/rmi/RMIConnectorServer.java
@@ -423,7 +423,7 @@ public class RMIConnectorServer extends JMXConnectorServer {
try {
if (tracing) logger.trace("start", "binding to " + jndiUrl);
- final Hashtable usemap = EnvHelp.mapToHashtable(attributes);
+ final Hashtable, ?> usemap = EnvHelp.mapToHashtable(attributes);
bind(jndiUrl, usemap, objref, rebind);
@@ -555,7 +555,7 @@ public class RMIConnectorServer extends JMXConnectorServer {
logger.trace("stop",
"unbind from external directory: " + boundJndiUrl);
- final Hashtable usemap = EnvHelp.mapToHashtable(attributes);
+ final Hashtable, ?> usemap = EnvHelp.mapToHashtable(attributes);
InitialContext ctx =
new InitialContext(usemap);
@@ -655,7 +655,7 @@ public class RMIConnectorServer extends JMXConnectorServer {
* @param rmiServer The object to bind in the registry
* @param rebind true if the object must be rebound.
**/
- void bind(String jndiUrl, Hashtable attributes,
+ void bind(String jndiUrl, Hashtable, ?> attributes,
RMIServer rmiServer, boolean rebind)
throws NamingException, MalformedURLException {
// if jndiURL is not null, we nust bind the stub to a
@@ -692,7 +692,8 @@ public class RMIConnectorServer extends JMXConnectorServer {
* @param attributes A Map containing environment parameters,
* built from the Map specified at this object creation.
**/
- private void encodeStubInAddress(RMIServer rmiServer, Map attributes)
+ private void encodeStubInAddress(
+ RMIServer rmiServer, Map attributes)
throws IOException {
final String protocol, host;
@@ -735,14 +736,16 @@ public class RMIConnectorServer extends JMXConnectorServer {
/**
* Returns the IOR of the given rmiServer.
**/
- static String encodeStub(RMIServer rmiServer, Map env) throws IOException {
+ static String encodeStub(
+ RMIServer rmiServer, Map env) throws IOException {
if (rmiServer instanceof javax.rmi.CORBA.Stub)
return "/ior/" + encodeIIOPStub(rmiServer, env);
else
return "/stub/" + encodeJRMPStub(rmiServer, env);
}
- static String encodeJRMPStub(RMIServer rmiServer, Map env)
+ static String encodeJRMPStub(
+ RMIServer rmiServer, Map env)
throws IOException {
ByteArrayOutputStream bout = new ByteArrayOutputStream();
ObjectOutputStream oout = new ObjectOutputStream(bout);
@@ -752,7 +755,8 @@ public class RMIConnectorServer extends JMXConnectorServer {
return byteArrayToBase64(bytes);
}
- static String encodeIIOPStub(RMIServer rmiServer, Map env)
+ static String encodeIIOPStub(
+ RMIServer rmiServer, Map env)
throws IOException {
try {
javax.rmi.CORBA.Stub stub =
@@ -767,7 +771,8 @@ public class RMIConnectorServer extends JMXConnectorServer {
* Object that we will bind to the registry.
* This object is a stub connected to our RMIServerImpl.
**/
- private static RMIServer objectToBind(RMIServerImpl rmiServer, Map env)
+ private static RMIServer objectToBind(
+ RMIServerImpl rmiServer, Map env)
throws IOException {
return RMIConnector.
connectStub((RMIServer)rmiServer.toStub(),env);
diff --git a/src/share/classes/javax/management/remote/rmi/RMIServerImpl.java b/src/share/classes/javax/management/remote/rmi/RMIServerImpl.java
index bc15562f5eb063c86cdb90d116713c49ab947c4b..d87b1d0544b7c34aa906fe18e4310dc9fcd41fdb 100644
--- a/src/share/classes/javax/management/remote/rmi/RMIServerImpl.java
+++ b/src/share/classes/javax/management/remote/rmi/RMIServerImpl.java
@@ -75,7 +75,7 @@ public abstract class RMIServerImpl implements Closeable, RMIServer {
* to an empty Map.
*/
public RMIServerImpl(Map env) {
- this.env = (env == null) ? Collections.EMPTY_MAP : env;
+ this.env = (env == null) ? Collections.emptyMap() : env;
}
void setRMIConnectorServer(RMIConnectorServer connServer)
@@ -337,8 +337,9 @@ public abstract class RMIServerImpl implements Closeable, RMIServer {
synchronized (clientList) {
dropDeadReferences();
- for (Iterator it = clientList.iterator(); it.hasNext(); ) {
- WeakReference wr = (WeakReference) it.next();
+ for (Iterator> it = clientList.iterator();
+ it.hasNext(); ) {
+ WeakReference wr = it.next();
if (wr.get() == client) {
it.remove();
break;
@@ -417,9 +418,10 @@ public abstract class RMIServerImpl implements Closeable, RMIServer {
dropDeadReferences(), this will usually be the first
element of the list, but a garbage collection could have
happened in between. */
- for (Iterator it = clientList.iterator(); it.hasNext(); ) {
- WeakReference wr = (WeakReference) it.next();
- RMIConnection client = (RMIConnection) wr.get();
+ for (Iterator> it = clientList.iterator();
+ it.hasNext(); ) {
+ WeakReference wr = it.next();
+ RMIConnection client = wr.get();
it.remove();
if (client != null) {
try {
@@ -475,10 +477,10 @@ public abstract class RMIServerImpl implements Closeable, RMIServer {
buf.append("//").append(clientHost);
buf.append(" ");
if (subject != null) {
- Set principals = subject.getPrincipals();
+ Set principals = subject.getPrincipals();
String sep = "";
- for (Iterator it = principals.iterator(); it.hasNext(); ) {
- Principal p = (Principal) it.next();
+ for (Iterator it = principals.iterator(); it.hasNext(); ) {
+ Principal p = it.next();
String name = p.getName().replace(' ', '_').replace(';', ':');
buf.append(sep).append(name);
sep = ";";
@@ -492,8 +494,9 @@ public abstract class RMIServerImpl implements Closeable, RMIServer {
private void dropDeadReferences() {
synchronized (clientList) {
- for (Iterator it = clientList.iterator(); it.hasNext(); ) {
- WeakReference wr = (WeakReference) it.next();
+ for (Iterator> it = clientList.iterator();
+ it.hasNext(); ) {
+ WeakReference wr = it.next();
if (wr.get() == null)
it.remove();
}
@@ -522,7 +525,7 @@ public abstract class RMIServerImpl implements Closeable, RMIServer {
private MBeanServer mbeanServer;
- private final Map env;
+ private final Map env;
private RMIConnectorServer connServer;
diff --git a/src/share/classes/javax/management/timer/Timer.java b/src/share/classes/javax/management/timer/Timer.java
index ea4d0b24a2a36cd05e348efe3acbec155cc0543a..909a1bbb0e55c6dd67b33f237df5531650c586b2 100644
--- a/src/share/classes/javax/management/timer/Timer.java
+++ b/src/share/classes/javax/management/timer/Timer.java
@@ -248,8 +248,7 @@ public class Timer extends NotificationBroadcasterSupport
*/
public synchronized MBeanNotificationInfo[] getNotificationInfo() {
Set notifTypes = new TreeSet();
- for (Iterator it = timerTable.values().iterator(); it.hasNext(); ) {
- Object[] entry = (Object[]) it.next();
+ for (Object[] entry : timerTable.values()) {
TimerNotification notif = (TimerNotification)
entry[TIMER_NOTIF_INDEX];
notifTypes.add(notif.getType());