protected URLStreamHandler findAuthorizedURLStreamHandler(String protocol) { Object factory = findAuthorizedFactory(ignoredClasses); if (factory == null) return null; if (factory == this) return createInternalURLStreamHandler(protocol); try { Method createInternalURLStreamHandlerMethod = factory.getClass().getMethod("createInternalURLStreamHandler", new Class[] {String.class}); //$NON-NLS-1$ return (URLStreamHandler) createInternalURLStreamHandlerMethod.invoke(factory, new Object[] {protocol}); } catch (Exception e) { container.getLogServices().log(URLStreamHandlerFactoryImpl.class.getName(), FrameworkLogEntry.ERROR, "findAuthorizedURLStreamHandler-loop", e); //$NON-NLS-1$ throw new RuntimeException(e.getMessage(), e); } }
private URLStreamHandler findAuthorizedURLStreamHandler(String requested) { URLStreamHandler handler = factory.findAuthorizedURLStreamHandler(requested); return handler == null ? authorized : handler; } }
if (isRecursive(protocol)) return null; try { Class<?> clazz = getBuiltIn(protocol, builtInHandlers); if (clazz != null) return null; // let the VM handle it URLStreamHandler result = null; if (isMultiplexing()) { URLStreamHandler authorized = findAuthorizedURLStreamHandler(protocol); if (authorized != null) result = new MultiplexingURLStreamHandler(protocol, this, authorized); } else { result = createInternalURLStreamHandler(protocol); return null; } finally { releaseRecursive(protocol);
private void installURLStreamHandlerFactory(BundleContext context) { URLStreamHandlerFactoryImpl shf = new URLStreamHandlerFactoryImpl(context, container); try { // first try the standard way URL.setURLStreamHandlerFactory(shf); } catch (Error err) { try { // ok we failed now use more drastic means to set the factory forceURLStreamHandlerFactory(shf); } catch (Exception ex) { container.getLogServices().log(EquinoxContainer.NAME, FrameworkLogEntry.ERROR, ex.getMessage(), ex); throw err; } } urlStreamHandlerFactory = shf; }
private void uninstallURLStreamHandlerFactory() { try { Field factoryField = getField(URL.class, URLStreamHandlerFactory.class, false); if (factoryField == null) return; // oh well, we tried Object lock = getURLStreamHandlerFactoryLock(); synchronized (lock) { URLStreamHandlerFactory factory = (URLStreamHandlerFactory) factoryField.get(null); if (factory == urlStreamHandlerFactory) { factory = (URLStreamHandlerFactory) urlStreamHandlerFactory.designateSuccessor(); } else { Method unregister = factory.getClass().getMethod("unregister", new Class[] {Object.class}); //$NON-NLS-1$ unregister.invoke(factory, new Object[] {urlStreamHandlerFactory}); } factoryField.set(null, null); // always attempt to clear the handlers cache // This allows an optimization for the single framework use-case // Note that the call to setURLStreamHandlerFactory below may clear this cache // but we want to be sure to clear it here just in case the parent is null. // In this case the call below would not occur. resetURLStreamHandlers(); if (factory != null) URL.setURLStreamHandlerFactory(factory); } } catch (Exception e) { // ignore and continue closing the framework } }
public URLStreamHandler createInternalURLStreamHandler(String protocol) { URLStreamHandler frameworkHandler = getFrameworkHandler(protocol); if (frameworkHandler != null) { return frameworkHandler;
if (isRecursive(protocol)) return null; try { Class<?> clazz = getBuiltIn(protocol, builtInHandlers); if (clazz != null) return null; // let the VM handle it URLStreamHandler result = null; if (isMultiplexing()) { URLStreamHandler authorized = findAuthorizedURLStreamHandler(protocol); if (authorized != null) result = new MultiplexingURLStreamHandler(protocol, this, authorized); } else { result = createInternalURLStreamHandler(protocol); return null; } finally { releaseRecursive(protocol);
private void installURLStreamHandlerFactory(BundleContext context) { URLStreamHandlerFactoryImpl shf = new URLStreamHandlerFactoryImpl(context, container); try { // first try the standard way URL.setURLStreamHandlerFactory(shf); } catch (Error err) { try { // ok we failed now use more drastic means to set the factory forceURLStreamHandlerFactory(shf); } catch (Exception ex) { container.getLogServices().log(EquinoxContainer.NAME, FrameworkLogEntry.ERROR, ex.getMessage(), ex); throw err; } } urlStreamHandlerFactory = shf; }
private void uninstallURLStreamHandlerFactory() { try { Field factoryField = getField(URL.class, URLStreamHandlerFactory.class, false); if (factoryField == null) return; // oh well, we tried Object lock = getURLStreamHandlerFactoryLock(); synchronized (lock) { URLStreamHandlerFactory factory = (URLStreamHandlerFactory) factoryField.get(null); if (factory == urlStreamHandlerFactory) { factory = (URLStreamHandlerFactory) urlStreamHandlerFactory.designateSuccessor(); } else { Method unregister = factory.getClass().getMethod("unregister", new Class[] {Object.class}); //$NON-NLS-1$ unregister.invoke(factory, new Object[] {urlStreamHandlerFactory}); } factoryField.set(null, null); // always attempt to clear the handlers cache // This allows an optimization for the single framework use-case // Note that the call to setURLStreamHandlerFactory below may clear this cache // but we want to be sure to clear it here just in case the parent is null. // In this case the call below would not occur. resetURLStreamHandlers(); if (factory != null) URL.setURLStreamHandlerFactory(factory); } } catch (Exception e) { // ignore and continue closing the framework } }
public URLStreamHandler createInternalURLStreamHandler(String protocol) { URLStreamHandler frameworkHandler = getFrameworkHandler(protocol); if (frameworkHandler != null) { return frameworkHandler;
if (isRecursive(protocol)) return null; try { Class<?> clazz = getBuiltIn(protocol, builtInHandlers); if (clazz != null) return null; // let the VM handle it URLStreamHandler result = null; if (isMultiplexing()) { URLStreamHandler authorized = findAuthorizedURLStreamHandler(protocol); if (authorized != null) result = new MultiplexingURLStreamHandler(protocol, this, authorized); } else { result = createInternalURLStreamHandler(protocol); return null; } finally { releaseRecursive(protocol);
protected URLStreamHandler findAuthorizedURLStreamHandler(String protocol) { Object factory = findAuthorizedFactory(ignoredClasses); if (factory == null) return null; if (factory == this) return createInternalURLStreamHandler(protocol); try { Method createInternalURLStreamHandlerMethod = factory.getClass().getMethod("createInternalURLStreamHandler", new Class[] {String.class}); //$NON-NLS-1$ return (URLStreamHandler) createInternalURLStreamHandlerMethod.invoke(factory, new Object[] {protocol}); } catch (Exception e) { container.getLogServices().log(URLStreamHandlerFactoryImpl.class.getName(), FrameworkLogEntry.ERROR, "findAuthorizedURLStreamHandler-loop", e); //$NON-NLS-1$ throw new RuntimeException(e.getMessage(), e); } }
private URLStreamHandler findAuthorizedURLStreamHandler(String requested) { URLStreamHandler handler = factory.findAuthorizedURLStreamHandler(requested); return handler == null ? authorized : handler; } }
private void installURLStreamHandlerFactory(BundleContext context) { URLStreamHandlerFactoryImpl shf = new URLStreamHandlerFactoryImpl(context, container); try { // first try the standard way URL.setURLStreamHandlerFactory(shf); } catch (Error err) { try { // ok we failed now use more drastic means to set the factory forceURLStreamHandlerFactory(shf); } catch (Exception ex) { container.getLogServices().log(EquinoxContainer.NAME, FrameworkLogEntry.ERROR, ex.getMessage(), ex); throw err; } } urlStreamHandlerFactory = shf; }
private void uninstallURLStreamHandlerFactory() { try { Field factoryField = getField(URL.class, URLStreamHandlerFactory.class, false); if (factoryField == null) return; // oh well, we tried Object lock = getURLStreamHandlerFactoryLock(); synchronized (lock) { URLStreamHandlerFactory factory = (URLStreamHandlerFactory) factoryField.get(null); if (factory == urlStreamHandlerFactory) { factory = (URLStreamHandlerFactory) urlStreamHandlerFactory.designateSuccessor(); } else { Method unregister = factory.getClass().getMethod("unregister", new Class[] {Object.class}); //$NON-NLS-1$ unregister.invoke(factory, new Object[] {urlStreamHandlerFactory}); } factoryField.set(null, null); // always attempt to clear the handlers cache // This allows an optimization for the single framework use-case // Note that the call to setURLStreamHandlerFactory below may clear this cache // but we want to be sure to clear it here just in case the parent is null. // In this case the call below would not occur. resetURLStreamHandlers(); if (factory != null) URL.setURLStreamHandlerFactory(factory); } } catch (Exception e) { // ignore and continue closing the framework } }
public URLStreamHandler createInternalURLStreamHandler(String protocol) { URLStreamHandler frameworkHandler = getFrameworkHandler(protocol); if (frameworkHandler != null) { return frameworkHandler;
if (isRecursive(protocol)) return null; try { Class<?> clazz = getBuiltIn(protocol, builtInHandlers); if (clazz != null) return null; // let the VM handle it URLStreamHandler result = null; if (isMultiplexing()) { URLStreamHandler authorized = findAuthorizedURLStreamHandler(protocol); if (authorized != null) result = new MultiplexingURLStreamHandler(protocol, this, authorized); } else { result = createInternalURLStreamHandler(protocol); return null; } finally { releaseRecursive(protocol);
protected URLStreamHandler findAuthorizedURLStreamHandler(String protocol) { Object factory = findAuthorizedFactory(ignoredClasses); if (factory == null) return null; if (factory == this) return createInternalURLStreamHandler(protocol); try { Method createInternalURLStreamHandlerMethod = factory.getClass().getMethod("createInternalURLStreamHandler", new Class[] {String.class}); //$NON-NLS-1$ return (URLStreamHandler) createInternalURLStreamHandlerMethod.invoke(factory, new Object[] {protocol}); } catch (Exception e) { container.getLogServices().log(URLStreamHandlerFactoryImpl.class.getName(), FrameworkLogEntry.ERROR, "findAuthorizedURLStreamHandler-loop", e); //$NON-NLS-1$ throw new RuntimeException(e.getMessage(), e); } }
private URLStreamHandler findAuthorizedURLStreamHandler(String requested) { URLStreamHandler handler = factory.findAuthorizedURLStreamHandler(requested); return handler == null ? authorized : handler; } }
private void installURLStreamHandlerFactory(BundleContext context) { URLStreamHandlerFactoryImpl shf = new URLStreamHandlerFactoryImpl(context, container); try { // first try the standard way URL.setURLStreamHandlerFactory(shf); } catch (Error err) { try { // ok we failed now use more drastic means to set the factory forceURLStreamHandlerFactory(shf); } catch (Exception ex) { container.getLogServices().log(EquinoxContainer.NAME, FrameworkLogEntry.ERROR, ex.getMessage(), ex); throw err; } } urlStreamHandlerFactory = shf; }