Java Code Examples for java.net.URLConnection#getPermission()
The following examples show how to use
java.net.URLConnection#getPermission() .
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: JarFileFactory.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private Permission getPermission(JarFile jarFile) { try { URLConnection uc = getConnection(jarFile); if (uc != null) return uc.getPermission(); } catch (IOException ioe) { // gulp } return null; }
Example 2
Source File: JarFileFactory.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private Permission getPermission(JarFile jarFile) { try { URLConnection uc = getConnection(jarFile); if (uc != null) return uc.getPermission(); } catch (IOException ioe) { // gulp } return null; }
Example 3
Source File: URLClassPath.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
static void check(URL url) throws IOException { SecurityManager security = System.getSecurityManager(); if (security != null) { URLConnection urlConnection = url.openConnection(); Permission perm = urlConnection.getPermission(); if (perm != null) { try { security.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) { security.checkRead(perm.getName()); } else if ((perm instanceof java.net.SocketPermission) && perm.getActions().indexOf("connect") != -1) { URL locUrl = url; if (urlConnection instanceof JarURLConnection) { locUrl = ((JarURLConnection)urlConnection).getJarFileURL(); } security.checkConnect(locUrl.getHost(), locUrl.getPort()); } else { throw se; } } } } }
Example 4
Source File: URLClassPath.java From Bytecoder with Apache License 2.0 | 5 votes |
public static void check(URL url) throws IOException { SecurityManager security = System.getSecurityManager(); if (security != null) { URLConnection urlConnection = url.openConnection(); Permission perm = urlConnection.getPermission(); if (perm != null) { try { security.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) { security.checkRead(perm.getName()); } else if ((perm instanceof java.net.SocketPermission) && perm.getActions().indexOf("connect") != -1) { URL locUrl = url; if (urlConnection instanceof JarURLConnection) { locUrl = ((JarURLConnection)urlConnection).getJarFileURL(); } security.checkConnect(locUrl.getHost(), locUrl.getPort()); } else { throw se; } } } } }
Example 5
Source File: JarFileFactory.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private Permission getPermission(JarFile jarFile) { try { URLConnection uc = getConnection(jarFile); if (uc != null) return uc.getPermission(); } catch (IOException ioe) { // gulp } return null; }
Example 6
Source File: JarFileFactory.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private Permission getPermission(JarFile jarFile) { try { URLConnection uc = getConnection(jarFile); if (uc != null) return uc.getPermission(); } catch (IOException ioe) { // gulp } return null; }
Example 7
Source File: JarFileFactory.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private Permission getPermission(JarFile jarFile) { try { URLConnection uc = getConnection(jarFile); if (uc != null) return uc.getPermission(); } catch (IOException ioe) { // gulp } return null; }
Example 8
Source File: URLClassPath.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
static void check(URL url) throws IOException { SecurityManager security = System.getSecurityManager(); if (security != null) { URLConnection urlConnection = url.openConnection(); Permission perm = urlConnection.getPermission(); if (perm != null) { try { security.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) { security.checkRead(perm.getName()); } else if ((perm instanceof java.net.SocketPermission) && perm.getActions().indexOf("connect") != -1) { URL locUrl = url; if (urlConnection instanceof JarURLConnection) { locUrl = ((JarURLConnection)urlConnection).getJarFileURL(); } security.checkConnect(locUrl.getHost(), locUrl.getPort()); } else { throw se; } } } } }
Example 9
Source File: URLClassPath.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
static void check(URL url) throws IOException { SecurityManager security = System.getSecurityManager(); if (security != null) { URLConnection urlConnection = url.openConnection(); Permission perm = urlConnection.getPermission(); if (perm != null) { try { security.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) { security.checkRead(perm.getName()); } else if ((perm instanceof java.net.SocketPermission) && perm.getActions().indexOf("connect") != -1) { URL locUrl = url; if (urlConnection instanceof JarURLConnection) { locUrl = ((JarURLConnection)urlConnection).getJarFileURL(); } security.checkConnect(locUrl.getHost(), locUrl.getPort()); } else { throw se; } } } } }
Example 10
Source File: JarFileFactory.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private Permission getPermission(JarFile jarFile) { try { URLConnection uc = getConnection(jarFile); if (uc != null) return uc.getPermission(); } catch (IOException ioe) { // gulp } return null; }
Example 11
Source File: URLClassPath.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
static void check(URL url) throws IOException { SecurityManager security = System.getSecurityManager(); if (security != null) { URLConnection urlConnection = url.openConnection(); Permission perm = urlConnection.getPermission(); if (perm != null) { try { security.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) { security.checkRead(perm.getName()); } else if ((perm instanceof java.net.SocketPermission) && perm.getActions().indexOf("connect") != -1) { URL locUrl = url; if (urlConnection instanceof JarURLConnection) { locUrl = ((JarURLConnection)urlConnection).getJarFileURL(); } security.checkConnect(locUrl.getHost(), locUrl.getPort()); } else { throw se; } } } } }
Example 12
Source File: URLClassPath.java From java-n-IDE-for-Android with Apache License 2.0 | 5 votes |
static void check(URL url) throws IOException { SecurityManager security = System.getSecurityManager(); if (security != null) { URLConnection urlConnection = url.openConnection(); Permission perm = urlConnection.getPermission(); if (perm != null) { try { security.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) { security.checkRead(perm.getName()); } else if ((perm instanceof java.net.SocketPermission) && perm.getActions().indexOf("connect") != -1) { URL locUrl = url; if (urlConnection instanceof JarURLConnection) { locUrl = ((JarURLConnection)urlConnection).getJarFileURL(); } security.checkConnect(locUrl.getHost(), locUrl.getPort()); } else { throw se; } } } } }
Example 13
Source File: JarFileFactory.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private Permission getPermission(JarFile jarFile) { try { URLConnection uc = getConnection(jarFile); if (uc != null) return uc.getPermission(); } catch (IOException ioe) { // gulp } return null; }
Example 14
Source File: JarFileFactory.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private Permission getPermission(JarFile jarFile) { try { URLConnection uc = getConnection(jarFile); if (uc != null) return uc.getPermission(); } catch (IOException ioe) { // gulp } return null; }
Example 15
Source File: JarFileFactory.java From hottub with GNU General Public License v2.0 | 5 votes |
private Permission getPermission(JarFile jarFile) { try { URLConnection uc = getConnection(jarFile); if (uc != null) return uc.getPermission(); } catch (IOException ioe) { // gulp } return null; }
Example 16
Source File: JarFileFactory.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private Permission getPermission(JarFile jarFile) { try { URLConnection uc = getConnection(jarFile); if (uc != null) return uc.getPermission(); } catch (IOException ioe) { // gulp } return null; }
Example 17
Source File: JarFileFactory.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private Permission getPermission(JarFile jarFile) { try { URLConnection uc = getConnection(jarFile); if (uc != null) return uc.getPermission(); } catch (IOException ioe) { // gulp } return null; }
Example 18
Source File: URLClassPath.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
static void check(URL url) throws IOException { SecurityManager security = System.getSecurityManager(); if (security != null) { URLConnection urlConnection = url.openConnection(); Permission perm = urlConnection.getPermission(); if (perm != null) { try { security.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) { security.checkRead(perm.getName()); } else if ((perm instanceof java.net.SocketPermission) && perm.getActions().indexOf("connect") != -1) { URL locUrl = url; if (urlConnection instanceof JarURLConnection) { locUrl = ((JarURLConnection)urlConnection).getJarFileURL(); } security.checkConnect(locUrl.getHost(), locUrl.getPort()); } else { throw se; } } } } }
Example 19
Source File: JarFileFactory.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private Permission getPermission(JarFile jarFile) { try { URLConnection uc = getConnection(jarFile); if (uc != null) return uc.getPermission(); } catch (IOException ioe) { // gulp } return null; }
Example 20
Source File: JarFileFactory.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private Permission getPermission(JarFile jarFile) { try { URLConnection uc = getConnection(jarFile); if (uc != null) return uc.getPermission(); } catch (IOException ioe) { // gulp } return null; }