Object obj = serviceReferences[i].getProperty(URLConstants.URL_CONTENT_MIMETYPE); if (obj != null && obj instanceof String[]) { String[] contentHandler = (String[]) obj; for (int j = 0; j < contentHandler.length; j++) { if (contentHandler[j].equals(contentType)) { proxy = new ContentHandlerProxy(contentType, serviceReferences[i], context); proxies.put(contentType, proxy); return (proxy); }
Object prop = serviceReferences[i].getProperty(URLConstants.URL_CONTENT_MIMETYPE); if (prop instanceof String) prop = new String[] {(String) prop}; if (!(prop instanceof String[])) { String message = NLS.bind(Msg.URL_HANDLER_INCORRECT_TYPE, new Object[] {URLConstants.URL_CONTENT_MIMETYPE, contentHandlerClazz, serviceReferences[i].getBundle()}); adaptor.getFrameworkLog().log(new FrameworkLogEntry(FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME, FrameworkLogEntry.WARNING, 0, message, 0, null, null)); continue; } String[] contentHandler = (String[]) prop; for (int j = 0; j < contentHandler.length; j++) { if (contentHandler[j].equals(contentType)) { proxy = new ContentHandlerProxy(contentType, serviceReferences[i], context); proxies.put(contentType, proxy); return (proxy);
	public ContentHandler createInternalContentHandler(String contentType) {		//first check to see if the handler is in the cache		ContentHandlerProxy proxy = (ContentHandlerProxy) proxies.get(contentType);		if (proxy != null) {			return (proxy);		}		org.osgi.framework.ServiceReference[] serviceReferences = contentHandlerTracker.getServiceReferences();		if (serviceReferences != null) {			for (int i = 0; i < serviceReferences.length; i++) {				Object obj = serviceReferences[i].getProperty(URLConstants.URL_CONTENT_MIMETYPE);				if (obj != null && obj instanceof String[]) {					String[] contentHandler = (String[]) obj;					for (int j = 0; j < contentHandler.length; j++) {						if (contentHandler[j].equals(contentType)) {							proxy = new ContentHandlerProxy(contentType, serviceReferences[i], context);							proxies.put(contentType, proxy);							return (proxy);						}					}				}			}		}		// if parent is present do parent lookup before returning a proxy		if (parentFactory != null) {			ContentHandler parentHandler = parentFactory.createContentHandler(contentType);			if (parentHandler != null)				return parentHandler;		}		//If we can't find the content handler in the service registry, return Proxy with DefaultContentHandler set.		//We need to do this because if we return null, we won't get called again for this content type.		proxy = new ContentHandlerProxy(contentType, null, context);		proxies.put(contentType, proxy);		return (proxy);	}