Field handlersField = getStaticField(URLConnection.class, Hashtable.class); if (handlersField != null) { Hashtable handlers = (Hashtable) handlersField.get(null); if (handlers != null) handlers.clear(); } if (chf != null && chf.getParentFactory() != null) URLConnection.setContentHandlerFactory(chf.getParentFactory());
resetContentHandlers(); if (factory != null) URLConnection.setContentHandlerFactory(factory);
	private static void uninstallContentHandlerFactory() {		try {			Field factoryField = getStaticField(URLConnection.class, java.net.ContentHandlerFactory.class);			if (factoryField == null)				return;  // oh well, we tried.			synchronized(URLConnection.class) {				ContentHandlerFactory chf = (ContentHandlerFactory) factoryField.get(null);				factoryField.set(null, null);				// always attempt to clear the handlers cache				// Note that the call to setContentHandlerFactory below may clear this cache				// but we want to be sure to clear it here just incase the parent is null.				// In this case the call below would not occur.				// Also it appears most java libraries actually do not clear the cache				// when setContentHandlerFactory is called, go figure!!				Field handlersField = getStaticField(URLConnection.class, Hashtable.class);				if (handlersField != null) {					Hashtable handlers = (Hashtable) handlersField.get(null);					if (handlers != null)						handlers.clear();				}				if (chf != null && chf.getParentFactory() != null) 					URLConnection.setContentHandlerFactory(chf.getParentFactory());			}		} catch (Exception e) {			// ignore and continue closing the framework		}			}