Mercurial > hg > graal-compiler
changeset 14137:aa2920aa838d
inverted security manager check and caller class check (JBS:GRAAL-22)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 11 Mar 2014 20:29:26 +0100 |
parents | 38c0db058dcd |
children | 0b8f4e50e149 |
files | graal/com.oracle.graal.api.runtime/src/com/oracle/graal/api/runtime/Graal.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java |
diffstat | 2 files changed, 12 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.api.runtime/src/com/oracle/graal/api/runtime/Graal.java Tue Mar 11 18:10:28 2014 +0100 +++ b/graal/com.oracle.graal.api.runtime/src/com/oracle/graal/api/runtime/Graal.java Tue Mar 11 20:29:26 2014 +0100 @@ -36,10 +36,10 @@ @CallerSensitive public static GraalRuntime getRuntime() { - Class cc = Reflection.getCallerClass(); - if (cc.getClassLoader() != null) { - SecurityManager sm = System.getSecurityManager(); - if (sm != null) { + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + Class cc = Reflection.getCallerClass(); + if (cc.getClassLoader() != null) { sm.checkPermission(ACCESS_PERMISSION); } } @@ -56,10 +56,10 @@ @CallerSensitive public static <T> T getRequiredCapability(Class<T> clazz) { - Class cc = Reflection.getCallerClass(); - if (cc.getClassLoader() != null) { - SecurityManager sm = System.getSecurityManager(); - if (sm != null) { + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + Class cc = Reflection.getCallerClass(); + if (cc.getClassLoader() != null) { sm.checkPermission(ACCESS_PERMISSION); } }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java Tue Mar 11 18:10:28 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java Tue Mar 11 20:29:26 2014 +0100 @@ -61,10 +61,10 @@ */ @CallerSensitive public static HotSpotGraalRuntime runtime() { - Class cc = Reflection.getCallerClass(); - if (cc != null && cc.getClassLoader() != null) { - SecurityManager sm = System.getSecurityManager(); - if (sm != null) { + SecurityManager sm = System.getSecurityManager(); + if (sm != null) { + Class cc = Reflection.getCallerClass(); + if (cc != null && cc.getClassLoader() != null) { sm.checkPermission(Graal.ACCESS_PERMISSION); } }