try { final ClassLoader cl = Thread.currentThread().getContextClassLoader(); final Class cls = cl.loadClass(clsname); Object obj = cls.newInstance(); if (!(obj instanceof URLStreamHandler)) continue; else ph = (URLStreamHandler)obj;
if (cache_handlers) { ph_cache.put(protocol, cls); }
	private static synchronized URLStreamHandler getURLStreamHandler(String protocol) {		URLStreamHandler ph;		// First, see if a protocol handler is in our cache		if (cache_handlers) {			Class cls = (Class)ph_cache.get(protocol);			if (cls != null) {				try {					ph = (URLStreamHandler)cls.newInstance();					return (ph);				} catch (Exception e) {					// Do nothing				}			}		}		// Next check the factory and use that if set		if (factory != null) {			ph = factory.createURLStreamHandler(protocol);			if (ph != null) {				if (cache_handlers)					ph_cache.put(protocol, ph.getClass());				return (ph);			}		}		// Finally loop through our search path looking for a match		StringTokenizer st = new StringTokenizer(ph_search_path, "|");		while (st.hasMoreTokens()) {			String clsname = st.nextToken() + "." + protocol + ".Handler";			try {				final ClassLoader cl = Thread.currentThread().getContextClassLoader();				final Class cls = cl.loadClass(clsname);				Object obj = cls.newInstance();				if (!(obj instanceof URLStreamHandler))					continue;				else					ph = (URLStreamHandler)obj;				if (cache_handlers)					ph_cache.put(protocol, cls);				return (ph);			} catch (Exception e) {				// Do nothing			}		}		// Still here, which is bad		return null;	}