Java Code Examples for java.util.ServiceConfigurationError#getCause()
The following examples show how to use
java.util.ServiceConfigurationError#getCause() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SelectorProvider.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private static boolean loadProviderAsService() { ServiceLoader<SelectorProvider> sl = ServiceLoader.load(SelectorProvider.class, ClassLoader.getSystemClassLoader()); Iterator<SelectorProvider> i = sl.iterator(); for (;;) { try { if (!i.hasNext()) return false; provider = i.next(); return true; } catch (ServiceConfigurationError sce) { if (sce.getCause() instanceof SecurityException) { // Ignore the security exception, try the next provider continue; } throw sce; } } }
Example 2
Source File: HttpServerProvider.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private static boolean loadProviderAsService() { Iterator<HttpServerProvider> i = ServiceLoader.load(HttpServerProvider.class, ClassLoader.getSystemClassLoader()) .iterator(); for (;;) { try { if (!i.hasNext()) return false; provider = i.next(); return true; } catch (ServiceConfigurationError sce) { if (sce.getCause() instanceof SecurityException) { // Ignore the security exception, try the next provider continue; } throw sce; } } }
Example 3
Source File: AsynchronousChannelProvider.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
private static AsynchronousChannelProvider loadProviderAsService() { ServiceLoader<AsynchronousChannelProvider> sl = ServiceLoader.load(AsynchronousChannelProvider.class, ClassLoader.getSystemClassLoader()); Iterator<AsynchronousChannelProvider> i = sl.iterator(); for (;;) { try { return (i.hasNext()) ? i.next() : null; } catch (ServiceConfigurationError sce) { if (sce.getCause() instanceof SecurityException) { // Ignore the security exception, try the next provider continue; } throw sce; } } }
Example 4
Source File: SelectorProvider.java From hottub with GNU General Public License v2.0 | 6 votes |
private static boolean loadProviderAsService() { ServiceLoader<SelectorProvider> sl = ServiceLoader.load(SelectorProvider.class, ClassLoader.getSystemClassLoader()); Iterator<SelectorProvider> i = sl.iterator(); for (;;) { try { if (!i.hasNext()) return false; provider = i.next(); return true; } catch (ServiceConfigurationError sce) { if (sce.getCause() instanceof SecurityException) { // Ignore the security exception, try the next provider continue; } throw sce; } } }
Example 5
Source File: HttpServerProvider.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private static boolean loadProviderAsService() { Iterator<HttpServerProvider> i = ServiceLoader.load(HttpServerProvider.class, ClassLoader.getSystemClassLoader()) .iterator(); for (;;) { try { if (!i.hasNext()) return false; provider = i.next(); return true; } catch (ServiceConfigurationError sce) { if (sce.getCause() instanceof SecurityException) { // Ignore the security exception, try the next provider continue; } throw sce; } } }
Example 6
Source File: SelectorProvider.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private static boolean loadProviderAsService() { ServiceLoader<SelectorProvider> sl = ServiceLoader.load(SelectorProvider.class, ClassLoader.getSystemClassLoader()); Iterator<SelectorProvider> i = sl.iterator(); for (;;) { try { if (!i.hasNext()) return false; provider = i.next(); return true; } catch (ServiceConfigurationError sce) { if (sce.getCause() instanceof SecurityException) { // Ignore the security exception, try the next provider continue; } throw sce; } } }
Example 7
Source File: SelectorProvider.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
private static boolean loadProviderAsService() { ServiceLoader<SelectorProvider> sl = ServiceLoader.load(SelectorProvider.class, ClassLoader.getSystemClassLoader()); Iterator<SelectorProvider> i = sl.iterator(); for (;;) { try { if (!i.hasNext()) return false; provider = i.next(); return true; } catch (ServiceConfigurationError sce) { if (sce.getCause() instanceof SecurityException) { // Ignore the security exception, try the next provider continue; } throw sce; } } }
Example 8
Source File: HttpServerProvider.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private static boolean loadProviderAsService() { Iterator<HttpServerProvider> i = ServiceLoader.load(HttpServerProvider.class, ClassLoader.getSystemClassLoader()) .iterator(); for (;;) { try { if (!i.hasNext()) return false; provider = i.next(); return true; } catch (ServiceConfigurationError sce) { if (sce.getCause() instanceof SecurityException) { // Ignore the security exception, try the next provider continue; } throw sce; } } }
Example 9
Source File: AsynchronousChannelProvider.java From JDKSourceCode1.8 with MIT License | 6 votes |
private static AsynchronousChannelProvider loadProviderAsService() { ServiceLoader<AsynchronousChannelProvider> sl = ServiceLoader.load(AsynchronousChannelProvider.class, ClassLoader.getSystemClassLoader()); Iterator<AsynchronousChannelProvider> i = sl.iterator(); for (;;) { try { return (i.hasNext()) ? i.next() : null; } catch (ServiceConfigurationError sce) { if (sce.getCause() instanceof SecurityException) { // Ignore the security exception, try the next provider continue; } throw sce; } } }
Example 10
Source File: HttpServerProvider.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private static boolean loadProviderAsService() { Iterator<HttpServerProvider> i = ServiceLoader.load(HttpServerProvider.class, ClassLoader.getSystemClassLoader()) .iterator(); for (;;) { try { if (!i.hasNext()) return false; provider = i.next(); return true; } catch (ServiceConfigurationError sce) { if (sce.getCause() instanceof SecurityException) { // Ignore the security exception, try the next provider continue; } throw sce; } } }
Example 11
Source File: HttpServerProvider.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
private static boolean loadProviderAsService() { Iterator<HttpServerProvider> i = ServiceLoader.load(HttpServerProvider.class, ClassLoader.getSystemClassLoader()) .iterator(); for (;;) { try { if (!i.hasNext()) return false; provider = i.next(); return true; } catch (ServiceConfigurationError sce) { if (sce.getCause() instanceof SecurityException) { // Ignore the security exception, try the next provider continue; } throw sce; } } }
Example 12
Source File: AsynchronousChannelProvider.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
private static AsynchronousChannelProvider loadProviderAsService() { ServiceLoader<AsynchronousChannelProvider> sl = ServiceLoader.load(AsynchronousChannelProvider.class, ClassLoader.getSystemClassLoader()); Iterator<AsynchronousChannelProvider> i = sl.iterator(); for (;;) { try { return (i.hasNext()) ? i.next() : null; } catch (ServiceConfigurationError sce) { if (sce.getCause() instanceof SecurityException) { // Ignore the security exception, try the next provider continue; } throw sce; } } }
Example 13
Source File: Preferences.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private static PreferencesFactory factory1() { // 2. Try service provider interface Iterator<PreferencesFactory> itr = ServiceLoader .load(PreferencesFactory.class, ClassLoader.getSystemClassLoader()) .iterator(); // choose first provider instance while (itr.hasNext()) { try { return itr.next(); } catch (ServiceConfigurationError sce) { if (sce.getCause() instanceof SecurityException) { // Ignore the security exception, try the next provider continue; } throw sce; } } // 3. Use platform-specific system-wide default String osName = System.getProperty("os.name"); String platformFactory; if (osName.startsWith("Windows")) { platformFactory = "java.util.prefs.WindowsPreferencesFactory"; } else if (osName.contains("OS X")) { platformFactory = "java.util.prefs.MacOSXPreferencesFactory"; } else { platformFactory = "java.util.prefs.FileSystemPreferencesFactory"; } try { return (PreferencesFactory) Class.forName(platformFactory, false, Preferences.class.getClassLoader()).newInstance(); } catch (Exception e) { throw new InternalError( "Can't instantiate platform default Preferences factory " + platformFactory, e); } }
Example 14
Source File: Preferences.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static PreferencesFactory factory1() { // 2. Try service provider interface Iterator<PreferencesFactory> itr = ServiceLoader .load(PreferencesFactory.class, ClassLoader.getSystemClassLoader()) .iterator(); // choose first provider instance while (itr.hasNext()) { try { return itr.next(); } catch (ServiceConfigurationError sce) { if (sce.getCause() instanceof SecurityException) { // Ignore the security exception, try the next provider continue; } throw sce; } } // 3. Use platform-specific system-wide default String osName = System.getProperty("os.name"); String platformFactory; if (osName.startsWith("Windows")) { platformFactory = "java.util.prefs.WindowsPreferencesFactory"; } else if (osName.contains("OS X")) { platformFactory = "java.util.prefs.MacOSXPreferencesFactory"; } else { platformFactory = "java.util.prefs.FileSystemPreferencesFactory"; } try { return (PreferencesFactory) Class.forName(platformFactory, false, Preferences.class.getClassLoader()).newInstance(); } catch (Exception e) { throw new InternalError( "Can't instantiate platform default Preferences factory " + platformFactory, e); } }
Example 15
Source File: Preferences.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static PreferencesFactory factory1() { // 2. Try service provider interface Iterator<PreferencesFactory> itr = ServiceLoader .load(PreferencesFactory.class, ClassLoader.getSystemClassLoader()) .iterator(); // choose first provider instance while (itr.hasNext()) { try { return itr.next(); } catch (ServiceConfigurationError sce) { if (sce.getCause() instanceof SecurityException) { // Ignore the security exception, try the next provider continue; } throw sce; } } // 3. Use platform-specific system-wide default String osName = System.getProperty("os.name"); String platformFactory; if (osName.startsWith("Windows")) { platformFactory = "java.util.prefs.WindowsPreferencesFactory"; } else if (osName.contains("OS X")) { platformFactory = "java.util.prefs.MacOSXPreferencesFactory"; } else { platformFactory = "java.util.prefs.FileSystemPreferencesFactory"; } try { return (PreferencesFactory) Class.forName(platformFactory, false, Preferences.class.getClassLoader()).newInstance(); } catch (Exception e) { throw new InternalError( "Can't instantiate platform default Preferences factory " + platformFactory, e); } }
Example 16
Source File: Charset.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
private static Iterator<CharsetProvider> providers() { return new Iterator<CharsetProvider>() { ClassLoader cl = ClassLoader.getSystemClassLoader(); ServiceLoader<CharsetProvider> sl = ServiceLoader.load(CharsetProvider.class, cl); Iterator<CharsetProvider> i = sl.iterator(); CharsetProvider next = null; private boolean getNext() { while (next == null) { try { if (!i.hasNext()) return false; next = i.next(); } catch (ServiceConfigurationError sce) { if (sce.getCause() instanceof SecurityException) { // Ignore security exceptions continue; } throw sce; } } return true; } public boolean hasNext() { return getNext(); } public CharsetProvider next() { if (!getNext()) throw new NoSuchElementException(); CharsetProvider n = next; next = null; return n; } public void remove() { throw new UnsupportedOperationException(); } }; }
Example 17
Source File: Charset.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
private static Iterator<CharsetProvider> providers() { return new Iterator<CharsetProvider>() { ClassLoader cl = ClassLoader.getSystemClassLoader(); ServiceLoader<CharsetProvider> sl = ServiceLoader.load(CharsetProvider.class, cl); Iterator<CharsetProvider> i = sl.iterator(); CharsetProvider next = null; private boolean getNext() { while (next == null) { try { if (!i.hasNext()) return false; next = i.next(); } catch (ServiceConfigurationError sce) { if (sce.getCause() instanceof SecurityException) { // Ignore security exceptions continue; } throw sce; } } return true; } public boolean hasNext() { return getNext(); } public CharsetProvider next() { if (!getNext()) throw new NoSuchElementException(); CharsetProvider n = next; next = null; return n; } public void remove() { throw new UnsupportedOperationException(); } }; }
Example 18
Source File: Charset.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
private static Iterator<CharsetProvider> providers() { return new Iterator<CharsetProvider>() { ClassLoader cl = ClassLoader.getSystemClassLoader(); ServiceLoader<CharsetProvider> sl = ServiceLoader.load(CharsetProvider.class, cl); Iterator<CharsetProvider> i = sl.iterator(); CharsetProvider next = null; private boolean getNext() { while (next == null) { try { if (!i.hasNext()) return false; next = i.next(); } catch (ServiceConfigurationError sce) { if (sce.getCause() instanceof SecurityException) { // Ignore security exceptions continue; } throw sce; } } return true; } public boolean hasNext() { return getNext(); } public CharsetProvider next() { if (!getNext()) throw new NoSuchElementException(); CharsetProvider n = next; next = null; return n; } public void remove() { throw new UnsupportedOperationException(); } }; }
Example 19
Source File: Charset.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
private static Iterator<CharsetProvider> providers() { return new Iterator<CharsetProvider>() { ClassLoader cl = ClassLoader.getSystemClassLoader(); ServiceLoader<CharsetProvider> sl = ServiceLoader.load(CharsetProvider.class, cl); Iterator<CharsetProvider> i = sl.iterator(); CharsetProvider next = null; private boolean getNext() { while (next == null) { try { if (!i.hasNext()) return false; next = i.next(); } catch (ServiceConfigurationError sce) { if (sce.getCause() instanceof SecurityException) { // Ignore security exceptions continue; } throw sce; } } return true; } public boolean hasNext() { return getNext(); } public CharsetProvider next() { if (!getNext()) throw new NoSuchElementException(); CharsetProvider n = next; next = null; return n; } public void remove() { throw new UnsupportedOperationException(); } }; }
Example 20
Source File: Charset.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
private static Iterator<CharsetProvider> providers() { return new Iterator<CharsetProvider>() { ClassLoader cl = ClassLoader.getSystemClassLoader(); ServiceLoader<CharsetProvider> sl = ServiceLoader.load(CharsetProvider.class, cl); Iterator<CharsetProvider> i = sl.iterator(); CharsetProvider next = null; private boolean getNext() { while (next == null) { try { if (!i.hasNext()) return false; next = i.next(); } catch (ServiceConfigurationError sce) { if (sce.getCause() instanceof SecurityException) { // Ignore security exceptions continue; } throw sce; } } return true; } public boolean hasNext() { return getNext(); } public CharsetProvider next() { if (!getNext()) throw new NoSuchElementException(); CharsetProvider n = next; next = null; return n; } public void remove() { throw new UnsupportedOperationException(); } }; }