Path: blob/master/runtime/jcl/common/acccont.c
6000 views
/*******************************************************************************1* Copyright (c) 1998, 2018 IBM Corp. and others2*3* This program and the accompanying materials are made available under4* the terms of the Eclipse Public License 2.0 which accompanies this5* distribution and is available at https://www.eclipse.org/legal/epl-2.0/6* or the Apache License, Version 2.0 which accompanies this distribution and7* is available at https://www.apache.org/licenses/LICENSE-2.0.8*9* This Source Code may also be made available under the following10* Secondary Licenses when the conditions for such availability set11* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU12* General Public License, version 2 with the GNU Classpath13* Exception [1] and GNU General Public License, version 2 with the14* OpenJDK Assembly Exception [2].15*16* [1] https://www.gnu.org/software/classpath/license.html17* [2] http://openjdk.java.net/legal/assembly-exception.html18*19* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception20*******************************************************************************/2122#include "jni.h"23#include "j2sever.h"24#include "j9.h"25#include "j9port.h"2627jboolean JNICALL Java_java_security_AccessController_initializeInternal(JNIEnv *env, jclass thisClz)28{29J9JavaVM *javaVM = ((J9VMThread *) env)->javaVM;30jclass accessControllerClass;31jmethodID mid;3233accessControllerClass = (*env)->FindClass(env, "java/security/AccessController");34if(accessControllerClass == NULL) goto fail;3536mid = (*env)->GetStaticMethodID(env, accessControllerClass, "doPrivileged", "(Ljava/security/PrivilegedAction;)Ljava/lang/Object;");37if(mid == NULL) goto fail;38javaVM->doPrivilegedMethodID1 = (UDATA) mid;3940mid = (*env)->GetStaticMethodID(env, accessControllerClass, "doPrivileged", "(Ljava/security/PrivilegedExceptionAction;)Ljava/lang/Object;");41if(mid == NULL) goto fail;42javaVM->doPrivilegedMethodID2 = (UDATA) mid;4344mid = (*env)->GetStaticMethodID(env, accessControllerClass, "doPrivileged", "(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;)Ljava/lang/Object;");45if(mid == NULL) goto fail;46javaVM->doPrivilegedWithContextMethodID1 = (UDATA) mid;4748mid = (*env)->GetStaticMethodID(env, accessControllerClass, "doPrivileged", "(Ljava/security/PrivilegedExceptionAction;Ljava/security/AccessControlContext;)Ljava/lang/Object;");49if(mid == NULL) goto fail;50javaVM->doPrivilegedWithContextMethodID2 = (UDATA) mid;5152mid = (*env)->GetStaticMethodID(env, accessControllerClass, "doPrivileged", "(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;[Ljava/security/Permission;)Ljava/lang/Object;");53if (NULL == mid) goto fail;54javaVM->doPrivilegedWithContextPermissionMethodID1 = (UDATA) mid;5556mid = (*env)->GetStaticMethodID(env, accessControllerClass, "doPrivileged", "(Ljava/security/PrivilegedExceptionAction;Ljava/security/AccessControlContext;[Ljava/security/Permission;)Ljava/lang/Object;");57if (NULL == mid) goto fail;58javaVM->doPrivilegedWithContextPermissionMethodID2 = (UDATA) mid;5960return JNI_TRUE;6162fail:63return JNI_FALSE;64}656667