Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openj9
Path: blob/master/runtime/jcl/common/acccont.c
6000 views
1
/*******************************************************************************
2
* Copyright (c) 1998, 2018 IBM Corp. and others
3
*
4
* This program and the accompanying materials are made available under
5
* the terms of the Eclipse Public License 2.0 which accompanies this
6
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
7
* or the Apache License, Version 2.0 which accompanies this distribution and
8
* is available at https://www.apache.org/licenses/LICENSE-2.0.
9
*
10
* This Source Code may also be made available under the following
11
* Secondary Licenses when the conditions for such availability set
12
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
13
* General Public License, version 2 with the GNU Classpath
14
* Exception [1] and GNU General Public License, version 2 with the
15
* OpenJDK Assembly Exception [2].
16
*
17
* [1] https://www.gnu.org/software/classpath/license.html
18
* [2] http://openjdk.java.net/legal/assembly-exception.html
19
*
20
* 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-exception
21
*******************************************************************************/
22
23
#include "jni.h"
24
#include "j2sever.h"
25
#include "j9.h"
26
#include "j9port.h"
27
28
jboolean JNICALL Java_java_security_AccessController_initializeInternal(JNIEnv *env, jclass thisClz)
29
{
30
J9JavaVM *javaVM = ((J9VMThread *) env)->javaVM;
31
jclass accessControllerClass;
32
jmethodID mid;
33
34
accessControllerClass = (*env)->FindClass(env, "java/security/AccessController");
35
if(accessControllerClass == NULL) goto fail;
36
37
mid = (*env)->GetStaticMethodID(env, accessControllerClass, "doPrivileged", "(Ljava/security/PrivilegedAction;)Ljava/lang/Object;");
38
if(mid == NULL) goto fail;
39
javaVM->doPrivilegedMethodID1 = (UDATA) mid;
40
41
mid = (*env)->GetStaticMethodID(env, accessControllerClass, "doPrivileged", "(Ljava/security/PrivilegedExceptionAction;)Ljava/lang/Object;");
42
if(mid == NULL) goto fail;
43
javaVM->doPrivilegedMethodID2 = (UDATA) mid;
44
45
mid = (*env)->GetStaticMethodID(env, accessControllerClass, "doPrivileged", "(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;)Ljava/lang/Object;");
46
if(mid == NULL) goto fail;
47
javaVM->doPrivilegedWithContextMethodID1 = (UDATA) mid;
48
49
mid = (*env)->GetStaticMethodID(env, accessControllerClass, "doPrivileged", "(Ljava/security/PrivilegedExceptionAction;Ljava/security/AccessControlContext;)Ljava/lang/Object;");
50
if(mid == NULL) goto fail;
51
javaVM->doPrivilegedWithContextMethodID2 = (UDATA) mid;
52
53
mid = (*env)->GetStaticMethodID(env, accessControllerClass, "doPrivileged", "(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;[Ljava/security/Permission;)Ljava/lang/Object;");
54
if (NULL == mid) goto fail;
55
javaVM->doPrivilegedWithContextPermissionMethodID1 = (UDATA) mid;
56
57
mid = (*env)->GetStaticMethodID(env, accessControllerClass, "doPrivileged", "(Ljava/security/PrivilegedExceptionAction;Ljava/security/AccessControlContext;[Ljava/security/Permission;)Ljava/lang/Object;");
58
if (NULL == mid) goto fail;
59
javaVM->doPrivilegedWithContextPermissionMethodID2 = (UDATA) mid;
60
61
return JNI_TRUE;
62
63
fail:
64
return JNI_FALSE;
65
}
66
67