aboutsummaryrefslogtreecommitdiff
path: root/src/share/classes/sun/rmi
diff options
context:
space:
mode:
authormartin <none@none>2008-03-10 15:07:09 -0700
committermartin <none@none>2008-03-10 15:07:09 -0700
commitcbc2edc7a946bf18b459ebf1fae69afda031b3e3 (patch)
treea21c1658e4ccfa792abe194177aebe7bd8c29733 /src/share/classes/sun/rmi
parent6eadddac51da90fca2e9e96bfdc121af15abe9f6 (diff)
6600143: Remove another 450 unnecessary casts
Reviewed-by: alanb, iris, lmalvent, bristor, peterjones, darcy, wetmore
Diffstat (limited to 'src/share/classes/sun/rmi')
-rw-r--r--src/share/classes/sun/rmi/log/ReliableLog.java8
-rw-r--r--src/share/classes/sun/rmi/registry/RegistryImpl.java23
-rw-r--r--src/share/classes/sun/rmi/rmic/RemoteClass.java33
-rw-r--r--src/share/classes/sun/rmi/rmic/newrmic/jrmp/RemoteClass.java6
-rw-r--r--src/share/classes/sun/rmi/runtime/Log.java15
-rw-r--r--src/share/classes/sun/rmi/server/LoaderHandler.java39
-rw-r--r--src/share/classes/sun/rmi/server/MarshalInputStream.java19
-rw-r--r--src/share/classes/sun/rmi/server/MarshalOutputStream.java4
-rw-r--r--src/share/classes/sun/rmi/server/Util.java20
-rw-r--r--src/share/classes/sun/rmi/server/WeakClassHashMap.java2
-rw-r--r--src/share/classes/sun/rmi/transport/DGCClient.java19
-rw-r--r--src/share/classes/sun/rmi/transport/Target.java6
-rw-r--r--src/share/classes/sun/rmi/transport/Transport.java6
-rw-r--r--src/share/classes/sun/rmi/transport/proxy/CGIHandler.java4
-rw-r--r--src/share/classes/sun/rmi/transport/proxy/HttpSendSocket.java2
-rw-r--r--src/share/classes/sun/rmi/transport/proxy/RMIMasterSocketFactory.java22
-rw-r--r--src/share/classes/sun/rmi/transport/tcp/ConnectionMultiplexer.java2
17 files changed, 117 insertions, 113 deletions
diff --git a/src/share/classes/sun/rmi/log/ReliableLog.java b/src/share/classes/sun/rmi/log/ReliableLog.java
index 7ac285819..542c6d27a 100644
--- a/src/share/classes/sun/rmi/log/ReliableLog.java
+++ b/src/share/classes/sun/rmi/log/ReliableLog.java
@@ -140,8 +140,8 @@ public class ReliableLog {
throws IOException
{
super();
- this.Debug = ((Boolean) AccessController.doPrivileged(
- new GetBooleanAction("sun.rmi.log.debug"))).booleanValue();
+ this.Debug = AccessController.doPrivileged(
+ new GetBooleanAction("sun.rmi.log.debug")).booleanValue();
dir = new File(dirPath);
if (!(dir.exists() && dir.isDirectory())) {
// create directory
@@ -333,8 +333,8 @@ public class ReliableLog {
private static Constructor<? extends LogFile>
getLogClassConstructor() {
- String logClassName = ((String) AccessController.doPrivileged(
- new GetPropertyAction("sun.rmi.log.class")));
+ String logClassName = AccessController.doPrivileged(
+ new GetPropertyAction("sun.rmi.log.class"));
if (logClassName != null) {
try {
ClassLoader loader =
diff --git a/src/share/classes/sun/rmi/registry/RegistryImpl.java b/src/share/classes/sun/rmi/registry/RegistryImpl.java
index 2f29cd570..7a99a014e 100644
--- a/src/share/classes/sun/rmi/registry/RegistryImpl.java
+++ b/src/share/classes/sun/rmi/registry/RegistryImpl.java
@@ -66,8 +66,10 @@ public class RegistryImpl extends java.rmi.server.RemoteServer
/* indicate compatibility with JDK 1.1.x version of class */
private static final long serialVersionUID = 4666870661827494597L;
- private Hashtable bindings = new Hashtable(101);
- private static Hashtable allowedAccessCache = new Hashtable(3);
+ private Hashtable<String, Remote> bindings
+ = new Hashtable<String, Remote>(101);
+ private static Hashtable<InetAddress, InetAddress> allowedAccessCache
+ = new Hashtable<InetAddress, InetAddress>(3);
private static RegistryImpl registry;
private static ObjID id = new ObjID(ObjID.REGISTRY_ID);
@@ -119,7 +121,7 @@ public class RegistryImpl extends java.rmi.server.RemoteServer
throws RemoteException, NotBoundException
{
synchronized (bindings) {
- Remote obj = (Remote)bindings.get(name);
+ Remote obj = bindings.get(name);
if (obj == null)
throw new NotBoundException(name);
return obj;
@@ -136,7 +138,7 @@ public class RegistryImpl extends java.rmi.server.RemoteServer
{
checkAccess("Registry.bind");
synchronized (bindings) {
- Remote curr = (Remote)bindings.get(name);
+ Remote curr = bindings.get(name);
if (curr != null)
throw new AlreadyBoundException(name);
bindings.put(name, obj);
@@ -153,7 +155,7 @@ public class RegistryImpl extends java.rmi.server.RemoteServer
{
checkAccess("Registry.unbind");
synchronized (bindings) {
- Remote obj = (Remote)bindings.get(name);
+ Remote obj = bindings.get(name);
if (obj == null)
throw new NotBoundException(name);
bindings.remove(name);
@@ -203,10 +205,9 @@ public class RegistryImpl extends java.rmi.server.RemoteServer
InetAddress clientHost;
try {
- clientHost = (InetAddress)
- java.security.AccessController.doPrivileged(
- new java.security.PrivilegedExceptionAction() {
- public Object run()
+ clientHost = java.security.AccessController.doPrivileged(
+ new java.security.PrivilegedExceptionAction<InetAddress>() {
+ public InetAddress run()
throws java.net.UnknownHostException
{
return InetAddress.getByName(clientHostName);
@@ -228,8 +229,8 @@ public class RegistryImpl extends java.rmi.server.RemoteServer
final InetAddress finalClientHost = clientHost;
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedExceptionAction() {
- public Object run() throws java.io.IOException {
+ new java.security.PrivilegedExceptionAction<Void>() {
+ public Void run() throws java.io.IOException {
/*
* if a ServerSocket can be bound to the client's
* address then that address must be local
diff --git a/src/share/classes/sun/rmi/rmic/RemoteClass.java b/src/share/classes/sun/rmi/rmic/RemoteClass.java
index 0caa07fe0..7d41be369 100644
--- a/src/share/classes/sun/rmi/rmic/RemoteClass.java
+++ b/src/share/classes/sun/rmi/rmic/RemoteClass.java
@@ -103,7 +103,7 @@ public class RemoteClass implements sun.rmi.rmic.RMIConstants {
* in the array).
*/
public ClassDefinition[] getRemoteInterfaces() {
- return (ClassDefinition[]) remoteInterfaces.clone();
+ return remoteInterfaces.clone();
}
/**
@@ -118,7 +118,7 @@ public class RemoteClass implements sun.rmi.rmic.RMIConstants {
* stub/skeleton protocol.
*/
public Method[] getRemoteMethods() {
- return (Method[]) remoteMethods.clone();
+ return remoteMethods.clone();
}
/**
@@ -204,8 +204,8 @@ public class RemoteClass implements sun.rmi.rmic.RMIConstants {
* chain, add each directly-implemented interface that
* somehow extends Remote to a list.
*/
- Vector remotesImplemented = // list of remote interfaces found
- new Vector();
+ Vector<ClassDefinition> remotesImplemented = // list of remote interfaces found
+ new Vector<ClassDefinition>();
for (ClassDefinition classDef = implClassDef;
classDef != null;)
{
@@ -307,13 +307,13 @@ public class RemoteClass implements sun.rmi.rmic.RMIConstants {
* Now we collect the methods from all of the remote interfaces
* into a hashtable.
*/
- Hashtable methods = new Hashtable();
+ Hashtable<String, Method> methods = new Hashtable<String, Method>();
boolean errors = false;
- for (Enumeration enumeration = remotesImplemented.elements();
+ for (Enumeration<ClassDefinition> enumeration
+ = remotesImplemented.elements();
enumeration.hasMoreElements();)
{
- ClassDefinition interfaceDef =
- (ClassDefinition) enumeration.nextElement();
+ ClassDefinition interfaceDef = enumeration.nextElement();
if (!collectRemoteMethods(interfaceDef, methods))
errors = true;
}
@@ -336,10 +336,10 @@ public class RemoteClass implements sun.rmi.rmic.RMIConstants {
*/
String[] orderedKeys = new String[methods.size()];
int count = 0;
- for (Enumeration enumeration = methods.elements();
+ for (Enumeration<Method> enumeration = methods.elements();
enumeration.hasMoreElements();)
{
- Method m = (Method) enumeration.nextElement();
+ Method m = enumeration.nextElement();
String key = m.getNameAndDescriptor();
int i;
for (i = count; i > 0; --i) {
@@ -353,7 +353,7 @@ public class RemoteClass implements sun.rmi.rmic.RMIConstants {
}
remoteMethods = new Method[methods.size()];
for (int i = 0; i < remoteMethods.length; i++) {
- remoteMethods[i] = (Method) methods.get(orderedKeys[i]);
+ remoteMethods[i] = methods.get(orderedKeys[i]);
/***** <DEBUG> */
if (env.verbose()) {
System.out.print("[found remote method <" + i + ">: " +
@@ -388,7 +388,7 @@ public class RemoteClass implements sun.rmi.rmic.RMIConstants {
* or false if an error occurred.
*/
private boolean collectRemoteMethods(ClassDefinition interfaceDef,
- Hashtable table)
+ Hashtable<String, Method> table)
{
if (!interfaceDef.isInterface()) {
throw new Error(
@@ -529,7 +529,7 @@ public class RemoteClass implements sun.rmi.rmic.RMIConstants {
* the new method (see bugid 4070653).
*/
String key = newMethod.getNameAndDescriptor();
- Method oldMethod = (Method) table.get(key);
+ Method oldMethod = table.get(key);
if (oldMethod != null) {
newMethod = newMethod.mergeWith(oldMethod);
if (newMethod == null) {
@@ -684,7 +684,7 @@ public class RemoteClass implements sun.rmi.rmic.RMIConstants {
* methods that can be legally thrown in each of them.
*/
public ClassDeclaration[] getExceptions() {
- return (ClassDeclaration[]) exceptions.clone();
+ return exceptions.clone();
}
/**
@@ -789,7 +789,8 @@ public class RemoteClass implements sun.rmi.rmic.RMIConstants {
getNameAndDescriptor());
}
- Vector legalExceptions = new Vector();
+ Vector<ClassDeclaration> legalExceptions
+ = new Vector<ClassDeclaration>();
try {
collectCompatibleExceptions(
other.exceptions, exceptions, legalExceptions);
@@ -814,7 +815,7 @@ public class RemoteClass implements sun.rmi.rmic.RMIConstants {
*/
private void collectCompatibleExceptions(ClassDeclaration[] from,
ClassDeclaration[] with,
- Vector list)
+ Vector<ClassDeclaration> list)
throws ClassNotFound
{
for (int i = 0; i < from.length; i++) {
diff --git a/src/share/classes/sun/rmi/rmic/newrmic/jrmp/RemoteClass.java b/src/share/classes/sun/rmi/rmic/newrmic/jrmp/RemoteClass.java
index f22a652df..064d2d0cc 100644
--- a/src/share/classes/sun/rmi/rmic/newrmic/jrmp/RemoteClass.java
+++ b/src/share/classes/sun/rmi/rmic/newrmic/jrmp/RemoteClass.java
@@ -121,7 +121,7 @@ final class RemoteClass {
* in the array).
**/
ClassDoc[] remoteInterfaces() {
- return (ClassDoc[]) remoteInterfaces.clone();
+ return remoteInterfaces.clone();
}
/**
@@ -136,7 +136,7 @@ final class RemoteClass {
* stub/skeleton protocol.
**/
Method[] remoteMethods() {
- return (Method[]) remoteMethods.clone();
+ return remoteMethods.clone();
}
/**
@@ -559,7 +559,7 @@ final class RemoteClass {
* methods that can be legally thrown by all of them.
**/
ClassDoc[] exceptionTypes() {
- return (ClassDoc[]) exceptionTypes.clone();
+ return exceptionTypes.clone();
}
/**
diff --git a/src/share/classes/sun/rmi/runtime/Log.java b/src/share/classes/sun/rmi/runtime/Log.java
index 3eb8ce9cf..8017ee0a1 100644
--- a/src/share/classes/sun/rmi/runtime/Log.java
+++ b/src/share/classes/sun/rmi/runtime/Log.java
@@ -71,7 +71,7 @@ public abstract class Log {
private static final LogFactory logFactory;
static {
boolean useOld =
- Boolean.valueOf((String) java.security.AccessController.
+ Boolean.valueOf(java.security.AccessController.
doPrivileged(new sun.security.action.GetPropertyAction(
"sun.rmi.log.useOld"))).booleanValue();
@@ -179,17 +179,16 @@ public abstract class Log {
private static class LoggerLog extends Log {
/* alternate console handler for RMI loggers */
- private static final Handler alternateConsole = (Handler)
+ private static final Handler alternateConsole =
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
- public Object run() {
+ new java.security.PrivilegedAction<Handler>() {
+ public Handler run() {
InternalStreamHandler alternate =
new InternalStreamHandler(System.err);
alternate.setLevel(Level.ALL);
return alternate;
}
- }
- );
+ });
/** handler to which messages are copied */
private InternalStreamHandler copyHandler = null;
@@ -206,8 +205,8 @@ public abstract class Log {
if (level != null){
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
- public Object run() {
+ new java.security.PrivilegedAction<Void>() {
+ public Void run() {
if (!logger.isLoggable(level)) {
logger.setLevel(level);
}
diff --git a/src/share/classes/sun/rmi/server/LoaderHandler.java b/src/share/classes/sun/rmi/server/LoaderHandler.java
index d4a9183e4..dcdecb0cc 100644
--- a/src/share/classes/sun/rmi/server/LoaderHandler.java
+++ b/src/share/classes/sun/rmi/server/LoaderHandler.java
@@ -70,7 +70,7 @@ public final class LoaderHandler {
/** RMI class loader log level */
static final int logLevel = LogStream.parseLevel(
- (String) java.security.AccessController.doPrivileged(
+ java.security.AccessController.doPrivileged(
new GetPropertyAction("sun.rmi.loader.logLevel")));
/* loader system log */
@@ -83,7 +83,7 @@ public final class LoaderHandler {
*/
private static String codebaseProperty = null;
static {
- String prop = (String) java.security.AccessController.doPrivileged(
+ String prop = java.security.AccessController.doPrivileged(
new GetPropertyAction("java.rmi.server.codebase"));
if (prop != null && prop.trim().length() > 0) {
codebaseProperty = prop;
@@ -94,8 +94,8 @@ public final class LoaderHandler {
private static URL[] codebaseURLs = null;
/** table of class loaders that use codebase property for annotation */
- private static final Map codebaseLoaders =
- Collections.synchronizedMap(new IdentityHashMap(5));
+ private static final Map<ClassLoader, Void> codebaseLoaders =
+ Collections.synchronizedMap(new IdentityHashMap<ClassLoader, Void>(5));
static {
for (ClassLoader codebaseLoader = ClassLoader.getSystemClassLoader();
codebaseLoader != null;
@@ -111,10 +111,12 @@ public final class LoaderHandler {
* references, so this table does not prevent loaders from being
* garbage collected.
*/
- private static final HashMap loaderTable = new HashMap(5);
+ private static final HashMap<LoaderKey, LoaderEntry> loaderTable
+ = new HashMap<LoaderKey, LoaderEntry>(5);
/** reference queue for cleared class loader entries */
- private static final ReferenceQueue refQueue = new ReferenceQueue();
+ private static final ReferenceQueue<Loader> refQueue
+ = new ReferenceQueue<Loader>();
/*
* Disallow anyone from creating one of these.
@@ -757,7 +759,7 @@ public final class LoaderHandler {
throws MalformedURLException
{
synchronized (pathToURLsCache) {
- Object[] v = (Object[]) pathToURLsCache.get(path);
+ Object[] v = pathToURLsCache.get(path);
if (v != null) {
return ((URL[])v[0]);
}
@@ -769,13 +771,14 @@ public final class LoaderHandler {
}
synchronized (pathToURLsCache) {
pathToURLsCache.put(path,
- new Object[] {urls, new SoftReference(path)});
+ new Object[] {urls, new SoftReference<String>(path)});
}
return urls;
}
/** map from weak(key=string) to [URL[], soft(key)] */
- private static final Map pathToURLsCache = new WeakHashMap(5);
+ private static final Map<String, Object[]> pathToURLsCache
+ = new WeakHashMap<String, Object[]>(5);
/**
* Convert an array of URL objects into a corresponding string
@@ -853,9 +856,9 @@ public final class LoaderHandler {
* in the table of RMI class loaders.
*/
LoaderKey key = new LoaderKey(urls, parent);
- entry = (LoaderEntry) loaderTable.get(key);
+ entry = loaderTable.get(key);
- if (entry == null || (loader = (Loader) entry.get()) == null) {
+ if (entry == null || (loader = entry.get()) == null) {
/*
* If entry was in table but it's weak reference was cleared,
* remove it from the table and mark it as explicitly cleared,
@@ -876,9 +879,9 @@ public final class LoaderHandler {
* necessary to load classes from its codebase URL path.
*/
AccessControlContext acc = getLoaderAccessControlContext(urls);
- loader = (Loader) java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
- public Object run() {
+ loader = java.security.AccessController.doPrivileged(
+ new java.security.PrivilegedAction<Loader>() {
+ public Loader run() {
return new Loader(urls, parent);
}
}, acc);
@@ -954,7 +957,7 @@ public final class LoaderHandler {
* loader key for the loader so that the mapping can be removed from
* the table efficiently when the weak reference is cleared.
*/
- private static class LoaderEntry extends WeakReference {
+ private static class LoaderEntry extends WeakReference<Loader> {
public LoaderKey key;
@@ -983,10 +986,10 @@ public final class LoaderHandler {
* getAccessControlContext() in the sun.applet.AppletPanel class.
*/
// begin with permissions granted to all code in current policy
- PermissionCollection perms = (PermissionCollection)
+ PermissionCollection perms =
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
- public Object run() {
+ new java.security.PrivilegedAction<PermissionCollection>() {
+ public PermissionCollection run() {
CodeSource codesource = new CodeSource(null,
(java.security.cert.Certificate[]) null);
Policy p = java.security.Policy.getPolicy();
diff --git a/src/share/classes/sun/rmi/server/MarshalInputStream.java b/src/share/classes/sun/rmi/server/MarshalInputStream.java
index a75b8051a..cf4e345d7 100644
--- a/src/share/classes/sun/rmi/server/MarshalInputStream.java
+++ b/src/share/classes/sun/rmi/server/MarshalInputStream.java
@@ -59,18 +59,20 @@ public class MarshalInputStream extends ObjectInputStream {
* as cached at class initialization time.
*/
private static final boolean useCodebaseOnlyProperty =
- ((Boolean) java.security.AccessController.doPrivileged(
+ java.security.AccessController.doPrivileged(
new sun.security.action.GetBooleanAction(
- "java.rmi.server.useCodebaseOnly"))).booleanValue();
+ "java.rmi.server.useCodebaseOnly")).booleanValue();
/** table to hold sun classes to which access is explicitly permitted */
- protected static Map permittedSunClasses = new HashMap(3);
+ protected static Map<String, Class<?>> permittedSunClasses
+ = new HashMap<String, Class<?>>(3);
/** if true, don't try superclass first in resolveClass() */
private boolean skipDefaultResolveClass = false;
/** callbacks to make when done() called: maps Object to Runnable */
- private final Map doneCallbacks = new HashMap(3);
+ private final Map<Object, Runnable> doneCallbacks
+ = new HashMap<Object, Runnable>(3);
/**
* if true, load classes (if not available locally) only from the
@@ -130,7 +132,7 @@ public class MarshalInputStream extends ObjectInputStream {
* with that key.
*/
public Runnable getDoneCallback(Object key) {
- return (Runnable) doneCallbacks.get(key); // not thread-safe
+ return doneCallbacks.get(key); // not thread-safe
}
/**
@@ -153,9 +155,9 @@ public class MarshalInputStream extends ObjectInputStream {
* the superclass's close method.
*/
public void done() {
- Iterator iter = doneCallbacks.values().iterator();
+ Iterator<Runnable> iter = doneCallbacks.values().iterator();
while (iter.hasNext()) { // not thread-safe
- Runnable callback = (Runnable) iter.next();
+ Runnable callback = iter.next();
callback.run();
}
doneCallbacks.clear();
@@ -276,8 +278,7 @@ public class MarshalInputStream extends ObjectInputStream {
name = perm.getName();
}
- Class resolvedClass =
- (Class) permittedSunClasses.get(className);
+ Class<?> resolvedClass = permittedSunClasses.get(className);
// if class not permitted, throw the SecurityException
if ((name == null) ||
diff --git a/src/share/classes/sun/rmi/server/MarshalOutputStream.java b/src/share/classes/sun/rmi/server/MarshalOutputStream.java
index 63aed2bee..067a5f2ec 100644
--- a/src/share/classes/sun/rmi/server/MarshalOutputStream.java
+++ b/src/share/classes/sun/rmi/server/MarshalOutputStream.java
@@ -64,8 +64,8 @@ public class MarshalOutputStream extends ObjectOutputStream
super(out);
this.useProtocolVersion(protocolVersion);
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
- public Object run() {
+ new java.security.PrivilegedAction<Void>() {
+ public Void run() {
enableReplaceObject(true);
return null;
}
diff --git a/src/share/classes/sun/rmi/server/Util.java b/src/share/classes/sun/rmi/server/Util.java
index f103319ce..f75787441 100644
--- a/src/share/classes/sun/rmi/server/Util.java
+++ b/src/share/classes/sun/rmi/server/Util.java
@@ -67,7 +67,7 @@ public final class Util {
/** "server" package log level */
static final int logLevel = LogStream.parseLevel(
- (String) AccessController.doPrivileged(
+ AccessController.doPrivileged(
new GetPropertyAction("sun.rmi.server.logLevel")));
/** server reference log */
@@ -76,13 +76,13 @@ public final class Util {
/** cached value of property java.rmi.server.ignoreStubClasses */
private static final boolean ignoreStubClasses =
- ((Boolean) AccessController.doPrivileged(
- new GetBooleanAction("java.rmi.server.ignoreStubClasses"))).
+ AccessController.doPrivileged(
+ new GetBooleanAction("java.rmi.server.ignoreStubClasses")).
booleanValue();
/** cache of impl classes that have no corresponding stub class */
- private static final Map withoutStubs =
- Collections.synchronizedMap(new WeakHashMap(11));
+ private static final Map<Class<?>, Void> withoutStubs =
+ Collections.synchronizedMap(new WeakHashMap<Class<?>, Void>(11));
/** parameter types for stub constructor */
private static final Class[] stubConsParamTypes = { RemoteRef.class };
@@ -207,9 +207,9 @@ public final class Util {
* @throws NullPointerException if remoteClass is null
*/
private static Class[] getRemoteInterfaces(Class remoteClass) {
- ArrayList list = new ArrayList();
+ ArrayList<Class<?>> list = new ArrayList<Class<?>>();
getRemoteInterfaces(list, remoteClass);
- return (Class []) list.toArray(new Class[list.size()]);
+ return list.toArray(new Class<?>[list.size()]);
}
/**
@@ -220,7 +220,7 @@ public final class Util {
* any illegal remote interfaces
* @throws NullPointerException if the specified class or list is null
*/
- private static void getRemoteInterfaces(ArrayList list, Class cl) {
+ private static void getRemoteInterfaces(ArrayList<Class<?>> list, Class cl) {
Class superclass = cl.getSuperclass();
if (superclass != null) {
getRemoteInterfaces(list, superclass);
@@ -254,7 +254,7 @@ public final class Util {
* @throws IllegalArgumentException if m is an illegal remote method
*/
private static void checkMethod(Method m) {
- Class[] ex = m.getExceptionTypes();
+ Class<?>[] ex = m.getExceptionTypes();
for (int i = 0; i < ex.length; i++) {
if (ex[i].isAssignableFrom(RemoteException.class))
return;
@@ -283,7 +283,7 @@ public final class Util {
* pickle methods
*/
try {
- Class stubcl =
+ Class<?> stubcl =
Class.forName(stubname, false, remoteClass.getClassLoader());
Constructor cons = stubcl.getConstructor(stubConsParamTypes);
return (RemoteStub) cons.newInstance(new Object[] { ref });
diff --git a/src/share/classes/sun/rmi/server/WeakClassHashMap.java b/src/share/classes/sun/rmi/server/WeakClassHashMap.java
index e822c2655..331930c36 100644
--- a/src/share/classes/sun/rmi/server/WeakClassHashMap.java
+++ b/src/share/classes/sun/rmi/server/WeakClassHashMap.java
@@ -69,7 +69,7 @@ public abstract class WeakClassHashMap<V> {
synchronized (valueCell) {
V value = null;
if (valueCell.ref != null) {
- value = (V) valueCell.ref.get();
+ value = valueCell.ref.get();
}
if (value == null) {
value = computeValue(remoteClass);
diff --git a/src/share/classes/sun/rmi/transport/DGCClient.java b/src/share/classes/sun/rmi/transport/DGCClient.java
index 31784b357..585901bbc 100644
--- a/src/share/classes/sun/rmi/transport/DGCClient.java
+++ b/src/share/classes/sun/rmi/transport/DGCClient.java
@@ -85,21 +85,21 @@ final class DGCClient {
/** lease duration to request (usually ignored by server) */
private static final long leaseValue = // default 10 minutes
- ((Long) AccessController.doPrivileged(
+ AccessController.doPrivileged(
new GetLongAction("java.rmi.dgc.leaseValue",
- 600000))).longValue();
+ 600000)).longValue();
/** maximum interval between retries of failed clean calls */
private static final long cleanInterval = // default 3 minutes
- ((Long) AccessController.doPrivileged(
+ AccessController.doPrivileged(
new GetLongAction("sun.rmi.dgc.cleanInterval",
- 180000))).longValue();
+ 180000)).longValue();
/** maximum interval between complete garbage collections of local heap */
private static final long gcInterval = // default 1 hour
- ((Long) AccessController.doPrivileged(
+ AccessController.doPrivileged(
new GetLongAction("sun.rmi.dgc.client.gcInterval",
- 3600000))).longValue();
+ 3600000)).longValue();
/** minimum retry count for dirty calls that fail */
private static final int dirtyFailureRetries = 5;
@@ -243,7 +243,7 @@ final class DGCClient {
} catch (RemoteException e) {
throw new Error("internal error creating DGC stub");
}
- renewCleanThread = (Thread) AccessController.doPrivileged(
+ renewCleanThread = AccessController.doPrivileged(
new NewThreadAction(new RenewCleanThread(),
"RenewClean-" + endpoint, true));
renewCleanThread.start();
@@ -473,8 +473,9 @@ final class DGCClient {
if (newRenewTime < renewTime) {
renewTime = newRenewTime;
if (interruptible) {
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
+ AccessController.doPrivileged(
+ new PrivilegedAction<Void>() {
+ public Void run() {
renewCleanThread.interrupt();
return null;
}
diff --git a/src/share/classes/sun/rmi/transport/Target.java b/src/share/classes/sun/rmi/transport/Target.java
index 01df43800..6abf092d7 100644
--- a/src/share/classes/sun/rmi/transport/Target.java
+++ b/src/share/classes/sun/rmi/transport/Target.java
@@ -321,7 +321,7 @@ public final class Target {
Remote obj = getImpl();
if (obj instanceof Unreferenced) {
final Unreferenced unrefObj = (Unreferenced) obj;
- final Thread t = (Thread)
+ final Thread t =
java.security.AccessController.doPrivileged(
new NewThreadAction(new Runnable() {
public void run() {
@@ -334,8 +334,8 @@ public final class Target {
* for threads that may invoke user code (see bugid 4171278).
*/
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
- public Object run() {
+ new java.security.PrivilegedAction<Void>() {
+ public Void run() {
t.setContextClassLoader(ccl);
return null;
}
diff --git a/src/share/classes/sun/rmi/transport/Transport.java b/src/share/classes/sun/rmi/transport/Transport.java
index 572a55b2b..67e6058d9 100644
--- a/src/share/classes/sun/rmi/transport/Transport.java
+++ b/src/share/classes/sun/rmi/transport/Transport.java
@@ -53,7 +53,7 @@ public abstract class Transport {
static final int logLevel = LogStream.parseLevel(getLogLevel());
private static String getLogLevel() {
- return (String) java.security.AccessController.doPrivileged(
+ return java.security.AccessController.doPrivileged(
new sun.security.action.GetPropertyAction("sun.rmi.transport.logLevel"));
}
@@ -171,8 +171,8 @@ public abstract class Transport {
currentTransport.set(this);
try {
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedExceptionAction() {
- public Object run() throws IOException {
+ new java.security.PrivilegedExceptionAction<Void>() {
+ public Void run() throws IOException {
checkAcceptPermission(acc);
disp.dispatch(impl, call);
return null;
diff --git a/src/share/classes/sun/rmi/transport/proxy/CGIHandler.java b/src/share/classes/sun/rmi/transport/proxy/CGIHandler.java
index 3d91ab0d1..cb4a88e56 100644
--- a/src/share/classes/sun/rmi/transport/proxy/CGIHandler.java
+++ b/src/share/classes/sun/rmi/transport/proxy/CGIHandler.java
@@ -89,8 +89,8 @@ public final class CGIHandler {
static {
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedAction() {
- public Object run() {
+ new java.security.PrivilegedAction<Void>() {
+ public Void run() {
ContentLength =
Integer.getInteger("CONTENT_LENGTH", 0).intValue();
QueryString = System.getProperty("QUERY_STRING", "");
diff --git a/src/share/classes/sun/rmi/transport/proxy/HttpSendSocket.java b/src/share/classes/sun/rmi/transport/proxy/HttpSendSocket.java
index 7498c9bfd..2c972d876 100644
--- a/src/share/classes/sun/rmi/transport/proxy/HttpSendSocket.java
+++ b/src/share/classes/sun/rmi/transport/proxy/HttpSendSocket.java
@@ -78,7 +78,7 @@ class HttpSendSocket extends Socket implements RMISocketInfo {
* property at the moment that the socket was created.
*/
private String lineSeparator =
- (String) java.security.AccessController.doPrivileged(
+ java.security.AccessController.doPrivileged(
new sun.security.action.GetPropertyAction("line.separator"));
/**
diff --git a/src/share/classes/sun/rmi/transport/proxy/RMIMasterSocketFactory.java b/src/share/classes/sun/rmi/transport/proxy/RMIMasterSocketFactory.java
index 16735959e..92d0dd77c 100644
--- a/src/share/classes/sun/rmi/transport/proxy/RMIMasterSocketFactory.java
+++ b/src/share/classes/sun/rmi/transport/proxy/RMIMasterSocketFactory.java
@@ -50,7 +50,7 @@ public class RMIMasterSocketFactory extends RMISocketFactory {
static int logLevel = LogStream.parseLevel(getLogLevel());
private static String getLogLevel() {
- return (String) java.security.AccessController.doPrivileged(
+ return java.security.AccessController.doPrivileged(
new sun.security.action.GetPropertyAction("sun.rmi.transport.proxy.logLevel"));
}
@@ -63,15 +63,15 @@ public class RMIMasterSocketFactory extends RMISocketFactory {
private static long connectTimeout = getConnectTimeout();
private static long getConnectTimeout() {
- return ((Long) java.security.AccessController.doPrivileged(
+ return java.security.AccessController.doPrivileged(
new GetLongAction("sun.rmi.transport.proxy.connectTimeout",
- 15000))).longValue(); // default: 15 seconds
+ 15000)).longValue(); // default: 15 seconds
}
/** whether to fallback to HTTP on general connect failures */
- private static final boolean eagerHttpFallback = ((Boolean)
+ private static final boolean eagerHttpFallback =
java.security.AccessController.doPrivileged(new GetBooleanAction(
- "sun.rmi.transport.proxy.eagerHttpFallback"))).booleanValue();
+ "sun.rmi.transport.proxy.eagerHttpFallback")).booleanValue();
/** table of hosts successfully connected to and the factory used */
private Hashtable successTable = new Hashtable();
@@ -100,14 +100,14 @@ public class RMIMasterSocketFactory extends RMISocketFactory {
try {
String proxyHost;
- proxyHost = (String) java.security.AccessController.doPrivileged(
+ proxyHost = java.security.AccessController.doPrivileged(
new sun.security.action.GetPropertyAction("http.proxyHost"));
if (proxyHost == null)
- proxyHost=(String)java.security.AccessController.doPrivileged(
+ proxyHost = java.security.AccessController.doPrivileged(
new sun.security.action.GetPropertyAction("proxyHost"));
- Boolean tmp = (Boolean)java.security.AccessController.doPrivileged(
+ Boolean tmp = java.security.AccessController.doPrivileged(
new sun.security.action.GetBooleanAction("java.rmi.server.disableHttp"));
if (!tmp.booleanValue() &&
@@ -178,10 +178,8 @@ public class RMIMasterSocketFactory extends RMISocketFactory {
try {
synchronized (connector) {
- Thread t = (Thread)
- java.security.AccessController.doPrivileged(
- new NewThreadAction(connector, "AsyncConnector",
- true));
+ Thread t = java.security.AccessController.doPrivileged(
+ new NewThreadAction(connector, "AsyncConnector", true));
t.start();
try {
diff --git a/src/share/classes/sun/rmi/transport/tcp/ConnectionMultiplexer.java b/src/share/classes/sun/rmi/transport/tcp/ConnectionMultiplexer.java
index f756cd34f..ac26ac6d8 100644
--- a/src/share/classes/sun/rmi/transport/tcp/ConnectionMultiplexer.java
+++ b/src/share/classes/sun/rmi/transport/tcp/ConnectionMultiplexer.java
@@ -49,7 +49,7 @@ final class ConnectionMultiplexer {
static int logLevel = LogStream.parseLevel(getLogLevel());
private static String getLogLevel() {
- return (String) java.security.AccessController.doPrivileged(
+ return java.security.AccessController.doPrivileged(
new sun.security.action.GetPropertyAction("sun.rmi.transport.tcp.multiplex.logLevel"));
}