if (orig != null && orig.getClass().getName().equals(ContentHandlerFactory.class.getName())) throw new Error("Multiple ContentHandlerFactories not supported."); chf.setParentFactory(orig);
if (factory != null) { try { factory.getClass().getMethod("isMultiplexing", null); Method register = factory.getClass().getMethod("register", new Class[] {Object.class}); register.invoke(factory, new Object[] {chf}); } catch (NoSuchMethodException e) {  chf.setParentFactory(factory); factory = chf; } }
	private static void forceContentHandlerFactory(ContentHandlerFactory chf) throws Exception{		Field factoryField = getStaticField(URLConnection.class, java.net.ContentHandlerFactory.class);		if (factoryField == null)			throw new Exception("Could not find ContentHandlerFactory field"); //$NON-NLS-1$		synchronized(URLConnection.class) {			java.net.ContentHandlerFactory orig = (java.net.ContentHandlerFactory) factoryField.get(null);			// doing a null check here just in case, but it would be really strange if it was null, 			// because we failed to set the factory normally!!			if (orig != null && orig.getClass().getName().equals(ContentHandlerFactory.class.getName()))				throw new Error("Multiple ContentHandlerFactories not supported."); //$NON-NLS-1$			chf.setParentFactory(orig);			// null out the field so that we can successfully call setContentHandlerFactory			factoryField.set(null, null);			/* 			 * TODO may consider clearing the factory cache here because setContentHandlerFactory			 * does not actually clear the cache for you like URL.setURLStreamHandlerFacotry does, go figure!!			 */			URLConnection.setContentHandlerFactory(chf);		}	}