Java Code Examples for sun.net.util.URLUtil#getConnectPermission()
The following examples show how to use
sun.net.util.URLUtil#getConnectPermission() .
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: URLImageSource.java From Bytecoder with Apache License 2.0 | 6 votes |
public URLImageSource(URL u) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { try { java.security.Permission perm = URLUtil.getConnectPermission(u); if (perm != null) { sm.checkPermission(perm); } } catch (java.io.IOException ioe) { sm.checkConnect(u.getHost(), u.getPort()); } } this.url = u; }
Example 2
Source File: SunToolkit.java From Bytecoder with Apache License 2.0 | 5 votes |
private static void checkPermissions(URL url) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { try { java.security.Permission perm = URLUtil.getConnectPermission(url); if (perm != null) { sm.checkPermission(perm); } } catch (java.io.IOException ioe) { sm.checkConnect(url.getHost(), url.getPort()); } } }
Example 3
Source File: URLImageSource.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public URLImageSource(URL u) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { try { java.security.Permission perm = URLUtil.getConnectPermission(u); if (perm != null) { try { sm.checkPermission(perm); } catch (SecurityException se) { // fallback to checkRead/checkConnect for pre 1.2 // security managers if ((perm instanceof java.io.FilePermission) && perm.getActions().indexOf("read") != -1) { sm.checkRead(perm.getName()); } else if ((perm instanceof java.net.SocketPermission) && perm.getActions().indexOf("connect") != -1) { sm.checkConnect(u.getHost(), u.getPort()); } else { throw se; } } } } catch (java.io.IOException ioe) { sm.checkConnect(u.getHost(), u.getPort()); } } this.url = u; }
Example 4
Source File: SunToolkit.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private static void checkPermissions(URL url) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { try { java.security.Permission perm = URLUtil.getConnectPermission(url); if (perm != null) { try { sm.checkPermission(perm); } catch (SecurityException se) { // fallback to checkRead/checkConnect for pre 1.2 // security managers if ((perm instanceof java.io.FilePermission) && perm.getActions().indexOf("read") != -1) { sm.checkRead(perm.getName()); } else if ((perm instanceof java.net.SocketPermission) && perm.getActions().indexOf("connect") != -1) { sm.checkConnect(url.getHost(), url.getPort()); } else { throw se; } } } } catch (java.io.IOException ioe) { sm.checkConnect(url.getHost(), url.getPort()); } } }
Example 5
Source File: URLImageSource.java From hottub with GNU General Public License v2.0 | 5 votes |
public URLImageSource(URL u) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { try { java.security.Permission perm = URLUtil.getConnectPermission(u); if (perm != null) { try { sm.checkPermission(perm); } catch (SecurityException se) { // fallback to checkRead/checkConnect for pre 1.2 // security managers if ((perm instanceof java.io.FilePermission) && perm.getActions().indexOf("read") != -1) { sm.checkRead(perm.getName()); } else if ((perm instanceof java.net.SocketPermission) && perm.getActions().indexOf("connect") != -1) { sm.checkConnect(u.getHost(), u.getPort()); } else { throw se; } } } } catch (java.io.IOException ioe) { sm.checkConnect(u.getHost(), u.getPort()); } } this.url = u; }
Example 6
Source File: SunToolkit.java From hottub with GNU General Public License v2.0 | 5 votes |
private static void checkPermissions(URL url) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { try { java.security.Permission perm = URLUtil.getConnectPermission(url); if (perm != null) { try { sm.checkPermission(perm); } catch (SecurityException se) { // fallback to checkRead/checkConnect for pre 1.2 // security managers if ((perm instanceof java.io.FilePermission) && perm.getActions().indexOf("read") != -1) { sm.checkRead(perm.getName()); } else if ((perm instanceof java.net.SocketPermission) && perm.getActions().indexOf("connect") != -1) { sm.checkConnect(url.getHost(), url.getPort()); } else { throw se; } } } } catch (java.io.IOException ioe) { sm.checkConnect(url.getHost(), url.getPort()); } } }
Example 7
Source File: SunToolkit.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static void checkPermissions(URL url) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { try { java.security.Permission perm = URLUtil.getConnectPermission(url); if (perm != null) { try { sm.checkPermission(perm); } catch (SecurityException se) { // fallback to checkRead/checkConnect for pre 1.2 // security managers if ((perm instanceof java.io.FilePermission) && perm.getActions().indexOf("read") != -1) { sm.checkRead(perm.getName()); } else if ((perm instanceof java.net.SocketPermission) && perm.getActions().indexOf("connect") != -1) { sm.checkConnect(url.getHost(), url.getPort()); } else { throw se; } } } } catch (java.io.IOException ioe) { sm.checkConnect(url.getHost(), url.getPort()); } } }
Example 8
Source File: SunToolkit.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static void checkPermissions(URL url) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { try { java.security.Permission perm = URLUtil.getConnectPermission(url); if (perm != null) { try { sm.checkPermission(perm); } catch (SecurityException se) { // fallback to checkRead/checkConnect for pre 1.2 // security managers if ((perm instanceof java.io.FilePermission) && perm.getActions().indexOf("read") != -1) { sm.checkRead(perm.getName()); } else if ((perm instanceof java.net.SocketPermission) && perm.getActions().indexOf("connect") != -1) { sm.checkConnect(url.getHost(), url.getPort()); } else { throw se; } } } } catch (java.io.IOException ioe) { sm.checkConnect(url.getHost(), url.getPort()); } } }
Example 9
Source File: URLImageSource.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public URLImageSource(URL u) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { try { java.security.Permission perm = URLUtil.getConnectPermission(u); if (perm != null) { try { sm.checkPermission(perm); } catch (SecurityException se) { // fallback to checkRead/checkConnect for pre 1.2 // security managers if ((perm instanceof java.io.FilePermission) && perm.getActions().indexOf("read") != -1) { sm.checkRead(perm.getName()); } else if ((perm instanceof java.net.SocketPermission) && perm.getActions().indexOf("connect") != -1) { sm.checkConnect(u.getHost(), u.getPort()); } else { throw se; } } } } catch (java.io.IOException ioe) { sm.checkConnect(u.getHost(), u.getPort()); } } this.url = u; }
Example 10
Source File: SunToolkit.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static void checkPermissions(URL url) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { try { java.security.Permission perm = URLUtil.getConnectPermission(url); if (perm != null) { try { sm.checkPermission(perm); } catch (SecurityException se) { // fallback to checkRead/checkConnect for pre 1.2 // security managers if ((perm instanceof java.io.FilePermission) && perm.getActions().indexOf("read") != -1) { sm.checkRead(perm.getName()); } else if ((perm instanceof java.net.SocketPermission) && perm.getActions().indexOf("connect") != -1) { sm.checkConnect(url.getHost(), url.getPort()); } else { throw se; } } } } catch (java.io.IOException ioe) { sm.checkConnect(url.getHost(), url.getPort()); } } }
Example 11
Source File: SunToolkit.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private static void checkPermissions(URL url) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { try { java.security.Permission perm = URLUtil.getConnectPermission(url); if (perm != null) { try { sm.checkPermission(perm); } catch (SecurityException se) { // fallback to checkRead/checkConnect for pre 1.2 // security managers if ((perm instanceof java.io.FilePermission) && perm.getActions().indexOf("read") != -1) { sm.checkRead(perm.getName()); } else if ((perm instanceof java.net.SocketPermission) && perm.getActions().indexOf("connect") != -1) { sm.checkConnect(url.getHost(), url.getPort()); } else { throw se; } } } } catch (java.io.IOException ioe) { sm.checkConnect(url.getHost(), url.getPort()); } } }
Example 12
Source File: URLImageSource.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public URLImageSource(URL u) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { try { java.security.Permission perm = URLUtil.getConnectPermission(u); if (perm != null) { try { sm.checkPermission(perm); } catch (SecurityException se) { // fallback to checkRead/checkConnect for pre 1.2 // security managers if ((perm instanceof java.io.FilePermission) && perm.getActions().indexOf("read") != -1) { sm.checkRead(perm.getName()); } else if ((perm instanceof java.net.SocketPermission) && perm.getActions().indexOf("connect") != -1) { sm.checkConnect(u.getHost(), u.getPort()); } else { throw se; } } } } catch (java.io.IOException ioe) { sm.checkConnect(u.getHost(), u.getPort()); } } this.url = u; }
Example 13
Source File: URLImageSource.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public URLImageSource(URL u) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { try { java.security.Permission perm = URLUtil.getConnectPermission(u); if (perm != null) { try { sm.checkPermission(perm); } catch (SecurityException se) { // fallback to checkRead/checkConnect for pre 1.2 // security managers if ((perm instanceof java.io.FilePermission) && perm.getActions().indexOf("read") != -1) { sm.checkRead(perm.getName()); } else if ((perm instanceof java.net.SocketPermission) && perm.getActions().indexOf("connect") != -1) { sm.checkConnect(u.getHost(), u.getPort()); } else { throw se; } } } } catch (java.io.IOException ioe) { sm.checkConnect(u.getHost(), u.getPort()); } } this.url = u; }
Example 14
Source File: URLImageSource.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public URLImageSource(URL u) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { try { java.security.Permission perm = URLUtil.getConnectPermission(u); if (perm != null) { try { sm.checkPermission(perm); } catch (SecurityException se) { // fallback to checkRead/checkConnect for pre 1.2 // security managers if ((perm instanceof java.io.FilePermission) && perm.getActions().indexOf("read") != -1) { sm.checkRead(perm.getName()); } else if ((perm instanceof java.net.SocketPermission) && perm.getActions().indexOf("connect") != -1) { sm.checkConnect(u.getHost(), u.getPort()); } else { throw se; } } } } catch (java.io.IOException ioe) { sm.checkConnect(u.getHost(), u.getPort()); } } this.url = u; }
Example 15
Source File: SunToolkit.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static void checkPermissions(URL url) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { try { java.security.Permission perm = URLUtil.getConnectPermission(url); if (perm != null) { try { sm.checkPermission(perm); } catch (SecurityException se) { // fallback to checkRead/checkConnect for pre 1.2 // security managers if ((perm instanceof java.io.FilePermission) && perm.getActions().indexOf("read") != -1) { sm.checkRead(perm.getName()); } else if ((perm instanceof java.net.SocketPermission) && perm.getActions().indexOf("connect") != -1) { sm.checkConnect(url.getHost(), url.getPort()); } else { throw se; } } } } catch (java.io.IOException ioe) { sm.checkConnect(url.getHost(), url.getPort()); } } }
Example 16
Source File: URLImageSource.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public URLImageSource(URL u) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { try { java.security.Permission perm = URLUtil.getConnectPermission(u); if (perm != null) { try { sm.checkPermission(perm); } catch (SecurityException se) { // fallback to checkRead/checkConnect for pre 1.2 // security managers if ((perm instanceof java.io.FilePermission) && perm.getActions().indexOf("read") != -1) { sm.checkRead(perm.getName()); } else if ((perm instanceof java.net.SocketPermission) && perm.getActions().indexOf("connect") != -1) { sm.checkConnect(u.getHost(), u.getPort()); } else { throw se; } } } } catch (java.io.IOException ioe) { sm.checkConnect(u.getHost(), u.getPort()); } } this.url = u; }
Example 17
Source File: SunToolkit.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private static void checkPermissions(URL url) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { try { java.security.Permission perm = URLUtil.getConnectPermission(url); if (perm != null) { try { sm.checkPermission(perm); } catch (SecurityException se) { // fallback to checkRead/checkConnect for pre 1.2 // security managers if ((perm instanceof java.io.FilePermission) && perm.getActions().indexOf("read") != -1) { sm.checkRead(perm.getName()); } else if ((perm instanceof java.net.SocketPermission) && perm.getActions().indexOf("connect") != -1) { sm.checkConnect(url.getHost(), url.getPort()); } else { throw se; } } } } catch (java.io.IOException ioe) { sm.checkConnect(url.getHost(), url.getPort()); } } }
Example 18
Source File: URLImageSource.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public URLImageSource(URL u) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { try { java.security.Permission perm = URLUtil.getConnectPermission(u); if (perm != null) { try { sm.checkPermission(perm); } catch (SecurityException se) { // fallback to checkRead/checkConnect for pre 1.2 // security managers if ((perm instanceof java.io.FilePermission) && perm.getActions().indexOf("read") != -1) { sm.checkRead(perm.getName()); } else if ((perm instanceof java.net.SocketPermission) && perm.getActions().indexOf("connect") != -1) { sm.checkConnect(u.getHost(), u.getPort()); } else { throw se; } } } } catch (java.io.IOException ioe) { sm.checkConnect(u.getHost(), u.getPort()); } } this.url = u; }
Example 19
Source File: SunToolkit.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static void checkPermissions(URL url) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { try { java.security.Permission perm = URLUtil.getConnectPermission(url); if (perm != null) { try { sm.checkPermission(perm); } catch (SecurityException se) { // fallback to checkRead/checkConnect for pre 1.2 // security managers if ((perm instanceof java.io.FilePermission) && perm.getActions().indexOf("read") != -1) { sm.checkRead(perm.getName()); } else if ((perm instanceof java.net.SocketPermission) && perm.getActions().indexOf("connect") != -1) { sm.checkConnect(url.getHost(), url.getPort()); } else { throw se; } } } } catch (java.io.IOException ioe) { sm.checkConnect(url.getHost(), url.getPort()); } } }
Example 20
Source File: SunToolkit.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
private static void checkPermissions(URL url) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { try { java.security.Permission perm = URLUtil.getConnectPermission(url); if (perm != null) { try { sm.checkPermission(perm); } catch (SecurityException se) { // fallback to checkRead/checkConnect for pre 1.2 // security managers if ((perm instanceof java.io.FilePermission) && perm.getActions().indexOf("read") != -1) { sm.checkRead(perm.getName()); } else if ((perm instanceof java.net.SocketPermission) && perm.getActions().indexOf("connect") != -1) { sm.checkConnect(url.getHost(), url.getPort()); } else { throw se; } } } } catch (java.io.IOException ioe) { sm.checkConnect(url.getHost(), url.getPort()); } } }