Index: modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/Resolver.java =================================================================== --- modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/Resolver.java (revision 548227) +++ modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/Resolver.java (working copy) @@ -25,6 +25,7 @@ import java.net.InetAddress; import java.net.SocketTimeoutException; +import java.util.ArrayList; import java.util.Enumeration; import java.util.HashSet; import java.util.Hashtable; @@ -33,7 +34,6 @@ import java.util.Set; import java.util.StringTokenizer; import java.util.Vector; -//import java.util.logging.Level; import javax.naming.NameNotFoundException; import javax.naming.NamingException; @@ -99,9 +99,9 @@ private int threadNumberLimit; // vector with currently running Resolver threads - private final Vector resolverThreads = new Vector(); + private final ArrayList resolverThreads = new ArrayList(); // the list of host names that should be resolved - private final Vector hostnamesToResolve = new Vector(); + private final ArrayList hostnamesToResolve = new ArrayList(); // semaphore that controls access to both lists above private class ThreadListSemaphore {} private final Object threadListSemaphore = new ThreadListSemaphore(); @@ -1428,7 +1428,7 @@ synchronized (threadListSemaphore) { // check that no currently running thread looks for this hostname for (int i = 0; i < resolverThreads.size(); i++) { - Resolver.ThreadListEntry entry = resolverThreads.elementAt(i); + Resolver.ThreadListEntry entry = resolverThreads.get(i); if (ProviderMgr.namesAreEqual(hostname, entry.serverNameToResolve) && entry.dnsClass == dnsClass) @@ -1440,7 +1440,7 @@ } // check if the hostname is already scheduled for resolving for (int i = 0; i < hostnamesToResolve.size(); i++) { - Resolver.ThreadListEntry entry = hostnamesToResolve.elementAt(i); + Resolver.ThreadListEntry entry = hostnamesToResolve.get(i); if (ProviderMgr.namesAreEqual(hostname, entry.serverNameToResolve) && entry.dnsClass == dnsClass) @@ -1459,7 +1459,7 @@ newEntry = new Resolver.ThreadListEntry(); newEntry.serverNameToResolve = hostname; newEntry.dnsClass = dnsClass; - hostnamesToResolve.addElement(newEntry); + hostnamesToResolve.add(newEntry); // starting new thread that should make further updates by itself newThread = new Thread(this); //if (LogConst.DEBUG) { @@ -1483,10 +1483,10 @@ // update lists synchronized (threadListSemaphore) { if (hostnamesToResolve.size() > 0) { - entryToProcess = hostnamesToResolve.elementAt(0); + entryToProcess = hostnamesToResolve.get(0); hostnamesToResolve.remove(0); entryToProcess.thread = Thread.currentThread(); - resolverThreads.addElement(entryToProcess); + resolverThreads.add(entryToProcess); } else { //ProviderMgr.logger.warning( // "Resolver thread: no host name to resolve"); @@ -1515,7 +1515,7 @@ // update resolver threads list, remove info about current thread synchronized (threadListSemaphore) { for (int i = 0; i < resolverThreads.size(); i++) { - Resolver.ThreadListEntry entry = resolverThreads.elementAt(i); + Resolver.ThreadListEntry entry = resolverThreads.get(i); if (ProviderMgr.namesAreEqual( entryToProcess.serverNameToResolve, Index: modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/ResolverCache.java =================================================================== --- modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/ResolverCache.java (revision 548227) +++ modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/ResolverCache.java (working copy) @@ -24,7 +24,7 @@ package org.apache.harmony.jndi.provider.dns; import java.util.Enumeration; -import java.util.Hashtable; +import java.util.HashMap; import java.util.Vector; /** @@ -37,14 +37,14 @@ class ResolverCache { /** keys - zone & host names; values - vectors with RRs */ - Hashtable> names = new Hashtable>(); + HashMap> names = new HashMap>(); /** * Since ResolverCache is singleton class its constructor * should be hidden. */ private ResolverCache() { - names = new Hashtable>(); + names = new HashMap>(); } private static ResolverCache instance = null; @@ -146,7 +146,7 @@ * Removes all cached entries. */ synchronized void clear() { - names = new Hashtable>(); + names = new HashMap>(); } // additional class Index: modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/SList.java =================================================================== --- modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/SList.java (revision 548227) +++ modules/jndi/src/main/java/org/apache/harmony/jndi/provider/dns/SList.java (working copy) @@ -23,9 +23,9 @@ package org.apache.harmony.jndi.provider.dns; -import java.util.Vector; -import java.util.Hashtable; import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Vector; import org.apache.harmony.jndi.internal.nls.Messages; @@ -60,16 +60,13 @@ servers = new Vector(); } - private static SList instance = null; + private static SList instance = new SList(); /** * SList is a singleton class. * @return instance of SList */ static SList getInstance() { - if (instance == null) { - instance = new SList(); - } return instance; } Index: modules/jndi/src/main/java/javax/naming/spi/NamingManager.java =================================================================== --- modules/jndi/src/main/java/javax/naming/spi/NamingManager.java (revision 548227) +++ modules/jndi/src/main/java/javax/naming/spi/NamingManager.java (working copy) @@ -106,7 +106,7 @@ static InitialContextFactoryBuilder icfb; static ObjectFactoryBuilder ofb; - + NamingManager() { super(); // package private to prevent it being instanced but make it can be @@ -129,22 +129,21 @@ * @throws NamingException * for other errors encountered. */ - public static synchronized void setInitialContextFactoryBuilder( + public static void setInitialContextFactoryBuilder( InitialContextFactoryBuilder icfb) throws IllegalStateException, SecurityException, NamingException { - - if (null != NamingManager.icfb) { - // jndi.1E=InitialContextFactoryBuilder cannot be reset - throw new IllegalStateException(Messages.getString("jndi.1E")); //$NON-NLS-1$ - } - // check security access SecurityManager sm = System.getSecurityManager(); if (null != sm) { sm.checkSetFactory(); } - - NamingManager.icfb = icfb; + synchronized (NamingManager.class) { + if (null != NamingManager.icfb) { + // jndi.1E=InitialContextFactoryBuilder cannot be reset + throw new IllegalStateException(Messages.getString("jndi.1E")); //$NON-NLS-1$ + } + NamingManager.icfb = icfb; + } } /**