< prev index next >
src/share/classes/sun/rmi/server/MarshalInputStream.java
Print this page
rev 1388 : 6600143: Remove another 450 unnecessary casts
Reviewed-by: alanb, iris, lmalvent, bristor, peterjones, darcy, wetmore
*** 73,89 ****
new sun.security.action.GetPropertyAction(
"java.rmi.server.useCodebaseOnly", "true"))
.equalsIgnoreCase("false");
/** table to hold sun classes to which access is explicitly permitted */
! protected static Map permittedSunClasses = new HashMap(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);
/**
* if true, load classes (if not available locally) only from the
* URL specified by the "java.rmi.server.codebase" property.
*/
--- 73,91 ----
new sun.security.action.GetPropertyAction(
"java.rmi.server.useCodebaseOnly", "true"))
.equalsIgnoreCase("false");
/** table to hold sun classes to which access is explicitly permitted */
! 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<Object, Runnable> doneCallbacks
! = new HashMap<Object, Runnable>(3);
/**
* if true, load classes (if not available locally) only from the
* URL specified by the "java.rmi.server.codebase" property.
*/
*** 139,149 ****
* Returns a callback previously registered via the setDoneCallback
* method with given key, or null if no callback has yet been registered
* with that key.
*/
public Runnable getDoneCallback(Object key) {
! return (Runnable) doneCallbacks.get(key); // not thread-safe
}
/**
* Registers a callback to make when this stream's done() method is
* invoked, along with a key for retrieving the same callback instance
--- 141,151 ----
* Returns a callback previously registered via the setDoneCallback
* method with given key, or null if no callback has yet been registered
* with that key.
*/
public Runnable getDoneCallback(Object key) {
! return doneCallbacks.get(key); // not thread-safe
}
/**
* Registers a callback to make when this stream's done() method is
* invoked, along with a key for retrieving the same callback instance
*** 162,174 ****
*
* This method is implicitly invoked by close() before it delegates to
* the superclass's close method.
*/
public void done() {
! Iterator iter = doneCallbacks.values().iterator();
while (iter.hasNext()) { // not thread-safe
! Runnable callback = (Runnable) iter.next();
callback.run();
}
doneCallbacks.clear();
}
--- 164,176 ----
*
* This method is implicitly invoked by close() before it delegates to
* the superclass's close method.
*/
public void done() {
! Iterator<Runnable> iter = doneCallbacks.values().iterator();
while (iter.hasNext()) { // not thread-safe
! Runnable callback = iter.next();
callback.run();
}
doneCallbacks.clear();
}
*** 290,301 ****
String name = null;
if (perm != null) {
name = perm.getName();
}
! Class resolvedClass =
! (Class) permittedSunClasses.get(className);
// if class not permitted, throw the SecurityException
if ((name == null) ||
(resolvedClass == null) ||
((!name.equals("accessClassInPackage.sun.rmi.server")) &&
--- 292,302 ----
String name = null;
if (perm != null) {
name = perm.getName();
}
! Class<?> resolvedClass = permittedSunClasses.get(className);
// if class not permitted, throw the SecurityException
if ((name == null) ||
(resolvedClass == null) ||
((!name.equals("accessClassInPackage.sun.rmi.server")) &&
< prev index next >