Java Code Examples for sun.reflect.misc.ReflectUtil#checkProxyPackageAccess()
The following examples show how to use
sun.reflect.misc.ReflectUtil#checkProxyPackageAccess() .
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: Class.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private void checkPackageAccess(final ClassLoader ccl, boolean checkProxyInterfaces) { final SecurityManager s = System.getSecurityManager(); if (s != null) { final ClassLoader cl = getClassLoader0(); if (ReflectUtil.needsPackageAccessCheck(ccl, cl)) { String name = this.getName(); int i = name.lastIndexOf('.'); if (i != -1) { // skip the package access check on a proxy class in default proxy package String pkg = name.substring(0, i); if (!Proxy.isProxyClass(this) || ReflectUtil.isNonPublicProxyClass(this)) { s.checkPackageAccess(pkg); } } } // check package access on the proxy interfaces if (checkProxyInterfaces && Proxy.isProxyClass(this)) { ReflectUtil.checkProxyPackageAccess(ccl, this.getInterfaces()); } } }
Example 2
Source File: Class.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
private void checkPackageAccess(final ClassLoader ccl, boolean checkProxyInterfaces) { final SecurityManager s = System.getSecurityManager(); if (s != null) { final ClassLoader cl = getClassLoader0(); if (ReflectUtil.needsPackageAccessCheck(ccl, cl)) { String name = this.getName(); int i = name.lastIndexOf('.'); if (i != -1) { // skip the package access check on a proxy class in default proxy package String pkg = name.substring(0, i); if (!Proxy.isProxyClass(this) || ReflectUtil.isNonPublicProxyClass(this)) { s.checkPackageAccess(pkg); } } } // check package access on the proxy interfaces if (checkProxyInterfaces && Proxy.isProxyClass(this)) { ReflectUtil.checkProxyPackageAccess(ccl, this.getInterfaces()); } } }
Example 3
Source File: Class.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
private void checkPackageAccess(final ClassLoader ccl, boolean checkProxyInterfaces) { final SecurityManager s = System.getSecurityManager(); if (s != null) { final ClassLoader cl = getClassLoader0(); if (ReflectUtil.needsPackageAccessCheck(ccl, cl)) { String name = this.getName(); int i = name.lastIndexOf('.'); if (i != -1) { // skip the package access check on a proxy class in default proxy package String pkg = name.substring(0, i); if (!Proxy.isProxyClass(this) || ReflectUtil.isNonPublicProxyClass(this)) { s.checkPackageAccess(pkg); } } } // check package access on the proxy interfaces if (checkProxyInterfaces && Proxy.isProxyClass(this)) { ReflectUtil.checkProxyPackageAccess(ccl, this.getInterfaces()); } } }
Example 4
Source File: Class.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private void checkPackageAccess(final ClassLoader ccl, boolean checkProxyInterfaces) { final SecurityManager s = System.getSecurityManager(); if (s != null) { final ClassLoader cl = getClassLoader0(); if (ReflectUtil.needsPackageAccessCheck(ccl, cl)) { String name = this.getName(); int i = name.lastIndexOf('.'); if (i != -1) { // skip the package access check on a proxy class in default proxy package String pkg = name.substring(0, i); if (!Proxy.isProxyClass(this) || ReflectUtil.isNonPublicProxyClass(this)) { s.checkPackageAccess(pkg); } } } // check package access on the proxy interfaces if (checkProxyInterfaces && Proxy.isProxyClass(this)) { ReflectUtil.checkProxyPackageAccess(ccl, this.getInterfaces()); } } }
Example 5
Source File: Class.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private void checkPackageAccess(final ClassLoader ccl, boolean checkProxyInterfaces) { final SecurityManager s = System.getSecurityManager(); if (s != null) { final ClassLoader cl = getClassLoader0(); if (ReflectUtil.needsPackageAccessCheck(ccl, cl)) { String name = this.getName(); int i = name.lastIndexOf('.'); if (i != -1) { // skip the package access check on a proxy class in default proxy package String pkg = name.substring(0, i); if (!Proxy.isProxyClass(this) || ReflectUtil.isNonPublicProxyClass(this)) { s.checkPackageAccess(pkg); } } } // check package access on the proxy interfaces if (checkProxyInterfaces && Proxy.isProxyClass(this)) { ReflectUtil.checkProxyPackageAccess(ccl, this.getInterfaces()); } } }
Example 6
Source File: Class.java From jdk-1.7-annotated with Apache License 2.0 | 6 votes |
private void checkPackageAccess(final ClassLoader ccl, boolean checkProxyInterfaces) { final SecurityManager s = System.getSecurityManager(); if (s != null) { final ClassLoader cl = getClassLoader0(); if (ReflectUtil.needsPackageAccessCheck(ccl, cl)) { String name = this.getName(); int i = name.lastIndexOf('.'); if (i != -1) { // skip the package access check on a proxy class in default proxy package String pkg = name.substring(0, i); if (!Proxy.isProxyClass(this) || ReflectUtil.isNonPublicProxyClass(this)) { s.checkPackageAccess(pkg); } } } // check package access on the proxy interfaces if (checkProxyInterfaces && Proxy.isProxyClass(this)) { ReflectUtil.checkProxyPackageAccess(ccl, this.getInterfaces()); } } }
Example 7
Source File: Class.java From Bytecoder with Apache License 2.0 | 6 votes |
private void checkPackageAccess(SecurityManager sm, final ClassLoader ccl, boolean checkProxyInterfaces) { final ClassLoader cl = getClassLoader0(); if (ReflectUtil.needsPackageAccessCheck(ccl, cl)) { String pkg = this.getPackageName(); if (pkg != null && !pkg.isEmpty()) { // skip the package access check on a proxy class in default proxy package if (!Proxy.isProxyClass(this) || ReflectUtil.isNonPublicProxyClass(this)) { sm.checkPackageAccess(pkg); } } } // check package access on the proxy interfaces if (checkProxyInterfaces && Proxy.isProxyClass(this)) { ReflectUtil.checkProxyPackageAccess(ccl, this.getInterfaces()); } }
Example 8
Source File: Proxy.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private static void checkProxyAccess(Class<?> caller, ClassLoader loader, Class<?>... interfaces) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { ClassLoader ccl = caller.getClassLoader(); if (VM.isSystemDomainLoader(loader) && !VM.isSystemDomainLoader(ccl)) { sm.checkPermission(SecurityConstants.GET_CLASSLOADER_PERMISSION); } ReflectUtil.checkProxyPackageAccess(ccl, interfaces); } }
Example 9
Source File: Proxy.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static void checkProxyAccess(Class<?> caller, ClassLoader loader, Class<?>... interfaces) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { ClassLoader ccl = caller.getClassLoader(); if (VM.isSystemDomainLoader(loader) && !VM.isSystemDomainLoader(ccl)) { sm.checkPermission(SecurityConstants.GET_CLASSLOADER_PERMISSION); } ReflectUtil.checkProxyPackageAccess(ccl, interfaces); } }
Example 10
Source File: Proxy.java From Java8CN with Apache License 2.0 | 5 votes |
private static void checkProxyAccess(Class<?> caller, ClassLoader loader, Class<?>... interfaces) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { ClassLoader ccl = caller.getClassLoader(); if (VM.isSystemDomainLoader(loader) && !VM.isSystemDomainLoader(ccl)) { sm.checkPermission(SecurityConstants.GET_CLASSLOADER_PERMISSION); } ReflectUtil.checkProxyPackageAccess(ccl, interfaces); } }
Example 11
Source File: Proxy.java From Bytecoder with Apache License 2.0 | 5 votes |
private static void checkProxyAccess(Class<?> caller, ClassLoader loader, Class<?> ... interfaces) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { ClassLoader ccl = caller.getClassLoader(); if (loader == null && ccl != null) { sm.checkPermission(SecurityConstants.GET_CLASSLOADER_PERMISSION); } ReflectUtil.checkProxyPackageAccess(ccl, interfaces); } }
Example 12
Source File: Proxy.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private static void checkProxyAccess(Class<?> caller, ClassLoader loader, Class<?>... interfaces) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { ClassLoader ccl = caller.getClassLoader(); if (VM.isSystemDomainLoader(loader) && !VM.isSystemDomainLoader(ccl)) { sm.checkPermission(SecurityConstants.GET_CLASSLOADER_PERMISSION); } ReflectUtil.checkProxyPackageAccess(ccl, interfaces); } }
Example 13
Source File: Proxy.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private static void checkProxyAccess(Class<?> caller, ClassLoader loader, Class<?>... interfaces) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { ClassLoader ccl = caller.getClassLoader(); if (VM.isSystemDomainLoader(loader) && !VM.isSystemDomainLoader(ccl)) { sm.checkPermission(SecurityConstants.GET_CLASSLOADER_PERMISSION); } ReflectUtil.checkProxyPackageAccess(ccl, interfaces); } }
Example 14
Source File: ObjectInputStream.java From Bytecoder with Apache License 2.0 | 4 votes |
/** * Reads in and returns class descriptor for a dynamic proxy class. Sets * passHandle to proxy class descriptor's assigned handle. If proxy class * descriptor cannot be resolved to a class in the local VM, a * ClassNotFoundException is associated with the descriptor's handle. */ private ObjectStreamClass readProxyDesc(boolean unshared) throws IOException { if (bin.readByte() != TC_PROXYCLASSDESC) { throw new InternalError(); } ObjectStreamClass desc = new ObjectStreamClass(); int descHandle = handles.assign(unshared ? unsharedMarker : desc); passHandle = NULL_HANDLE; int numIfaces = bin.readInt(); if (numIfaces > 65535) { throw new InvalidObjectException("interface limit exceeded: " + numIfaces); } String[] ifaces = new String[numIfaces]; for (int i = 0; i < numIfaces; i++) { ifaces[i] = bin.readUTF(); } Class<?> cl = null; ClassNotFoundException resolveEx = null; bin.setBlockDataMode(true); try { if ((cl = resolveProxyClass(ifaces)) == null) { resolveEx = new ClassNotFoundException("null class"); } else if (!Proxy.isProxyClass(cl)) { throw new InvalidClassException("Not a proxy"); } else { // ReflectUtil.checkProxyPackageAccess makes a test // equivalent to isCustomSubclass so there's no need // to condition this call to isCustomSubclass == true here. ReflectUtil.checkProxyPackageAccess( getClass().getClassLoader(), cl.getInterfaces()); // Filter the interfaces for (Class<?> clazz : cl.getInterfaces()) { filterCheck(clazz, -1); } } } catch (ClassNotFoundException ex) { resolveEx = ex; } // Call filterCheck on the class before reading anything else filterCheck(cl, -1); skipCustomData(); try { totalObjectRefs++; depth++; desc.initProxy(cl, resolveEx, readClassDesc(false)); } finally { depth--; } handles.finish(descHandle); passHandle = descHandle; return desc; }
Example 15
Source File: ObjectInputStream.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
/** * Reads in and returns class descriptor for a dynamic proxy class. Sets * passHandle to proxy class descriptor's assigned handle. If proxy class * descriptor cannot be resolved to a class in the local VM, a * ClassNotFoundException is associated with the descriptor's handle. */ private ObjectStreamClass readProxyDesc(boolean unshared) throws IOException { if (bin.readByte() != TC_PROXYCLASSDESC) { throw new InternalError(); } ObjectStreamClass desc = new ObjectStreamClass(); int descHandle = handles.assign(unshared ? unsharedMarker : desc); passHandle = NULL_HANDLE; int numIfaces = bin.readInt(); String[] ifaces = new String[numIfaces]; for (int i = 0; i < numIfaces; i++) { ifaces[i] = bin.readUTF(); } Class<?> cl = null; ClassNotFoundException resolveEx = null; bin.setBlockDataMode(true); try { if ((cl = resolveProxyClass(ifaces)) == null) { resolveEx = new ClassNotFoundException("null class"); } else if (!Proxy.isProxyClass(cl)) { throw new InvalidClassException("Not a proxy"); } else { // ReflectUtil.checkProxyPackageAccess makes a test // equivalent to isCustomSubclass so there's no need // to condition this call to isCustomSubclass == true here. ReflectUtil.checkProxyPackageAccess( getClass().getClassLoader(), cl.getInterfaces()); } } catch (ClassNotFoundException ex) { resolveEx = ex; } skipCustomData(); desc.initProxy(cl, resolveEx, readClassDesc(false)); handles.finish(descHandle); passHandle = descHandle; return desc; }
Example 16
Source File: ObjectInputStream.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * Reads in and returns class descriptor for a dynamic proxy class. Sets * passHandle to proxy class descriptor's assigned handle. If proxy class * descriptor cannot be resolved to a class in the local VM, a * ClassNotFoundException is associated with the descriptor's handle. */ private ObjectStreamClass readProxyDesc(boolean unshared) throws IOException { if (bin.readByte() != TC_PROXYCLASSDESC) { throw new InternalError(); } ObjectStreamClass desc = new ObjectStreamClass(); int descHandle = handles.assign(unshared ? unsharedMarker : desc); passHandle = NULL_HANDLE; int numIfaces = bin.readInt(); String[] ifaces = new String[numIfaces]; for (int i = 0; i < numIfaces; i++) { ifaces[i] = bin.readUTF(); } Class<?> cl = null; ClassNotFoundException resolveEx = null; bin.setBlockDataMode(true); try { if ((cl = resolveProxyClass(ifaces)) == null) { resolveEx = new ClassNotFoundException("null class"); } else if (!Proxy.isProxyClass(cl)) { throw new InvalidClassException("Not a proxy"); } else { // ReflectUtil.checkProxyPackageAccess makes a test // equivalent to isCustomSubclass so there's no need // to condition this call to isCustomSubclass == true here. ReflectUtil.checkProxyPackageAccess( getClass().getClassLoader(), cl.getInterfaces()); } } catch (ClassNotFoundException ex) { resolveEx = ex; } skipCustomData(); desc.initProxy(cl, resolveEx, readClassDesc(false)); handles.finish(descHandle); passHandle = descHandle; return desc; }
Example 17
Source File: ObjectInputStream.java From hottub with GNU General Public License v2.0 | 4 votes |
/** * Reads in and returns class descriptor for a dynamic proxy class. Sets * passHandle to proxy class descriptor's assigned handle. If proxy class * descriptor cannot be resolved to a class in the local VM, a * ClassNotFoundException is associated with the descriptor's handle. */ private ObjectStreamClass readProxyDesc(boolean unshared) throws IOException { if (bin.readByte() != TC_PROXYCLASSDESC) { throw new InternalError(); } ObjectStreamClass desc = new ObjectStreamClass(); int descHandle = handles.assign(unshared ? unsharedMarker : desc); passHandle = NULL_HANDLE; int numIfaces = bin.readInt(); String[] ifaces = new String[numIfaces]; for (int i = 0; i < numIfaces; i++) { ifaces[i] = bin.readUTF(); } Class<?> cl = null; ClassNotFoundException resolveEx = null; bin.setBlockDataMode(true); try { if ((cl = resolveProxyClass(ifaces)) == null) { resolveEx = new ClassNotFoundException("null class"); } else if (!Proxy.isProxyClass(cl)) { throw new InvalidClassException("Not a proxy"); } else { // ReflectUtil.checkProxyPackageAccess makes a test // equivalent to isCustomSubclass so there's no need // to condition this call to isCustomSubclass == true here. ReflectUtil.checkProxyPackageAccess( getClass().getClassLoader(), cl.getInterfaces()); } } catch (ClassNotFoundException ex) { resolveEx = ex; } skipCustomData(); desc.initProxy(cl, resolveEx, readClassDesc(false)); handles.finish(descHandle); passHandle = descHandle; return desc; }
Example 18
Source File: ObjectInputStream.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** * Reads in and returns class descriptor for a dynamic proxy class. Sets * passHandle to proxy class descriptor's assigned handle. If proxy class * descriptor cannot be resolved to a class in the local VM, a * ClassNotFoundException is associated with the descriptor's handle. */ private ObjectStreamClass readProxyDesc(boolean unshared) throws IOException { if (bin.readByte() != TC_PROXYCLASSDESC) { throw new InternalError(); } ObjectStreamClass desc = new ObjectStreamClass(); int descHandle = handles.assign(unshared ? unsharedMarker : desc); passHandle = NULL_HANDLE; int numIfaces = bin.readInt(); if (numIfaces > 65535) { throw new InvalidObjectException("interface limit exceeded: " + numIfaces); } String[] ifaces = new String[numIfaces]; for (int i = 0; i < numIfaces; i++) { ifaces[i] = bin.readUTF(); } Class<?> cl = null; ClassNotFoundException resolveEx = null; bin.setBlockDataMode(true); try { if ((cl = resolveProxyClass(ifaces)) == null) { resolveEx = new ClassNotFoundException("null class"); } else if (!Proxy.isProxyClass(cl)) { throw new InvalidClassException("Not a proxy"); } else { // ReflectUtil.checkProxyPackageAccess makes a test // equivalent to isCustomSubclass so there's no need // to condition this call to isCustomSubclass == true here. ReflectUtil.checkProxyPackageAccess( getClass().getClassLoader(), cl.getInterfaces()); // Filter the interfaces for (Class<?> clazz : cl.getInterfaces()) { filterCheck(clazz, -1); } } } catch (ClassNotFoundException ex) { resolveEx = ex; } // Call filterCheck on the class before reading anything else filterCheck(cl, -1); skipCustomData(); try { totalObjectRefs++; depth++; desc.initProxy(cl, resolveEx, readClassDesc(false)); } finally { depth--; } handles.finish(descHandle); passHandle = descHandle; return desc; }
Example 19
Source File: ObjectInputStream.java From jdk1.8-source-analysis with Apache License 2.0 | 4 votes |
/** * Reads in and returns class descriptor for a dynamic proxy class. Sets * passHandle to proxy class descriptor's assigned handle. If proxy class * descriptor cannot be resolved to a class in the local VM, a * ClassNotFoundException is associated with the descriptor's handle. */ private ObjectStreamClass readProxyDesc(boolean unshared) throws IOException { if (bin.readByte() != TC_PROXYCLASSDESC) { throw new InternalError(); } ObjectStreamClass desc = new ObjectStreamClass(); int descHandle = handles.assign(unshared ? unsharedMarker : desc); passHandle = NULL_HANDLE; int numIfaces = bin.readInt(); if (numIfaces > 65535) { throw new InvalidObjectException("interface limit exceeded: " + numIfaces); } String[] ifaces = new String[numIfaces]; for (int i = 0; i < numIfaces; i++) { ifaces[i] = bin.readUTF(); } Class<?> cl = null; ClassNotFoundException resolveEx = null; bin.setBlockDataMode(true); try { if ((cl = resolveProxyClass(ifaces)) == null) { resolveEx = new ClassNotFoundException("null class"); } else if (!Proxy.isProxyClass(cl)) { throw new InvalidClassException("Not a proxy"); } else { // ReflectUtil.checkProxyPackageAccess makes a test // equivalent to isCustomSubclass so there's no need // to condition this call to isCustomSubclass == true here. ReflectUtil.checkProxyPackageAccess( getClass().getClassLoader(), cl.getInterfaces()); // Filter the interfaces for (Class<?> clazz : cl.getInterfaces()) { filterCheck(clazz, -1); } } } catch (ClassNotFoundException ex) { resolveEx = ex; } // Call filterCheck on the class before reading anything else filterCheck(cl, -1); skipCustomData(); try { totalObjectRefs++; depth++; desc.initProxy(cl, resolveEx, readClassDesc(false)); } finally { depth--; } handles.finish(descHandle); passHandle = descHandle; return desc; }
Example 20
Source File: ObjectInputStream.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
/** * Reads in and returns class descriptor for a dynamic proxy class. Sets * passHandle to proxy class descriptor's assigned handle. If proxy class * descriptor cannot be resolved to a class in the local VM, a * ClassNotFoundException is associated with the descriptor's handle. */ private ObjectStreamClass readProxyDesc(boolean unshared) throws IOException { if (bin.readByte() != TC_PROXYCLASSDESC) { throw new InternalError(); } ObjectStreamClass desc = new ObjectStreamClass(); int descHandle = handles.assign(unshared ? unsharedMarker : desc); passHandle = NULL_HANDLE; int numIfaces = bin.readInt(); String[] ifaces = new String[numIfaces]; for (int i = 0; i < numIfaces; i++) { ifaces[i] = bin.readUTF(); } Class<?> cl = null; ClassNotFoundException resolveEx = null; bin.setBlockDataMode(true); try { if ((cl = resolveProxyClass(ifaces)) == null) { resolveEx = new ClassNotFoundException("null class"); } else if (!Proxy.isProxyClass(cl)) { throw new InvalidClassException("Not a proxy"); } else { // ReflectUtil.checkProxyPackageAccess makes a test // equivalent to isCustomSubclass so there's no need // to condition this call to isCustomSubclass == true here. ReflectUtil.checkProxyPackageAccess( getClass().getClassLoader(), cl.getInterfaces()); } } catch (ClassNotFoundException ex) { resolveEx = ex; } skipCustomData(); desc.initProxy(cl, resolveEx, readClassDesc(false)); handles.finish(descHandle); passHandle = descHandle; return desc; }