--- old/src/share/classes/com/sun/jndi/rmi/registry/RegistryContext.java 2011-07-27 17:22:56.826398700 -0700 +++ new/src/share/classes/com/sun/jndi/rmi/registry/RegistryContext.java 2011-07-27 17:22:56.197335800 -0700 @@ -46,7 +46,7 @@ public class RegistryContext implements Context, Referenceable { - private Hashtable environment; + private Hashtable environment; private Registry registry; private String host; private int port; @@ -67,10 +67,13 @@ * Cloning of "env" is handled by caller; see comments within * RegistryContextFactory.getObjectInstance(), for example. */ - public RegistryContext(String host, int port, Hashtable env) + @SuppressWarnings("unchecked") + public RegistryContext(String host, int port, Hashtable env) throws NamingException { - environment = ((env == null) ? new Hashtable(5) : env); + environment = (env == null) + ? new Hashtable(5) + : (Hashtable) env; if (environment.get(SECURITY_MGR) != null) { installSecurityMgr(); } @@ -93,8 +96,9 @@ * won't close the other). */ // %%% Alternatively, this could be done with a clone() method. + @SuppressWarnings("unchecked") // clone() RegistryContext(RegistryContext ctx) { - environment = (Hashtable)ctx.environment.clone(); + environment = (Hashtable)ctx.environment.clone(); registry = ctx.registry; host = ctx.host; port = ctx.port; @@ -195,7 +199,8 @@ rename(new CompositeName(name), new CompositeName(newName)); } - public NamingEnumeration list(Name name) throws NamingException { + public NamingEnumeration list(Name name) throws + NamingException { if (!name.isEmpty()) { throw (new InvalidNameException( "RegistryContext: can only list \"\"")); @@ -208,11 +213,12 @@ } } - public NamingEnumeration list(String name) throws NamingException { + public NamingEnumeration list(String name) throws + NamingException { return list(new CompositeName(name)); } - public NamingEnumeration listBindings(Name name) + public NamingEnumeration listBindings(Name name) throws NamingException { if (!name.isEmpty()) { @@ -227,7 +233,8 @@ } } - public NamingEnumeration listBindings(String name) throws NamingException { + public NamingEnumeration listBindings(String name) throws + NamingException { return listBindings(new CompositeName(name)); } @@ -290,8 +297,9 @@ return environment.put(propName, propVal); } - public Hashtable getEnvironment() throws NamingException { - return (Hashtable)environment.clone(); + @SuppressWarnings("unchecked") // clone() + public Hashtable getEnvironment() throws NamingException { + return (Hashtable)environment.clone(); } public void close() { @@ -483,11 +491,9 @@ /** - * An enumeration of name / class-name pairs. Since we don't know anything - * about the classes, each class name is returned as the generic - * "java.lang.Object". + * An enumeration of name / class-name pairs. */ -class NameClassPairEnumeration implements NamingEnumeration { +class NameClassPairEnumeration implements NamingEnumeration { private final String[] names; private int nextName; // index into "names" @@ -500,7 +506,7 @@ return (nextName < names.length); } - public Object next() throws NamingException { + public NameClassPair next() throws NamingException { if (!hasMore()) { throw (new java.util.NoSuchElementException()); } @@ -518,7 +524,7 @@ return hasMore(); } - public Object nextElement() { + public NameClassPair nextElement() { try { return next(); } catch (NamingException e) { // should never happen @@ -541,7 +547,7 @@ * requested. The problem with that approach is that Binding.getObject() * cannot throw NamingException. */ -class BindingEnumeration implements NamingEnumeration { +class BindingEnumeration implements NamingEnumeration { private RegistryContext ctx; private final String[] names; private int nextName; // index into "names" @@ -564,7 +570,7 @@ return (nextName < names.length); } - public Object next() throws NamingException { + public Binding next() throws NamingException { if (!hasMore()) { throw (new java.util.NoSuchElementException()); } @@ -584,7 +590,7 @@ return hasMore(); } - public Object nextElement() { + public Binding nextElement() { try { return next(); } catch (NamingException e) {