1 /*
2 * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
46 Pref nodes with shorter names are stored in com.apple.java.util.prefs.plist
47
48 The filesystem is assumed to be case-insensitive (like HFS+).
49 Java pref node names are case-sensitive. If two pref node names differ
50 only in case, they may end up in the same pref file. This is ok
51 because the CF keys identifying the node span the entire absolute path
52 to the node and are case-sensitive.
53
54 Java node names may contain '.' . When mapping to the CF file name,
55 these dots are left as-is, even though '/' is mapped to '.' .
56 This is ok because the CF key contains the correct node name.
57 */
58
59
60
61 #include <CoreFoundation/CoreFoundation.h>
62
63 #include "jni_util.h"
64 #include "jlong.h"
65 #include "jvm.h"
66
67
68 // Throw an OutOfMemoryError with the given message.
69 static void throwOutOfMemoryError(JNIEnv *env, const char *msg)
70 {
71 static jclass exceptionClass = NULL;
72 jclass c;
73
74 (*env)->ExceptionClear(env); // If an exception is pending, clear it before
75 // calling FindClass() and/or ThrowNew().
76 if (exceptionClass) {
77 c = exceptionClass;
78 } else {
79 c = (*env)->FindClass(env, "java/lang/OutOfMemoryError");
80 if ((*env)->ExceptionOccurred(env)) return;
81 exceptionClass = (*env)->NewGlobalRef(env, c);
82 }
83
84 (*env)->ThrowNew(env, c, msg);
85 }
|
1 /*
2 * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
46 Pref nodes with shorter names are stored in com.apple.java.util.prefs.plist
47
48 The filesystem is assumed to be case-insensitive (like HFS+).
49 Java pref node names are case-sensitive. If two pref node names differ
50 only in case, they may end up in the same pref file. This is ok
51 because the CF keys identifying the node span the entire absolute path
52 to the node and are case-sensitive.
53
54 Java node names may contain '.' . When mapping to the CF file name,
55 these dots are left as-is, even though '/' is mapped to '.' .
56 This is ok because the CF key contains the correct node name.
57 */
58
59
60
61 #include <CoreFoundation/CoreFoundation.h>
62
63 #include "jni_util.h"
64 #include "jlong.h"
65 #include "jvm.h"
66
67 /*
68 * Declare library specific JNI_Onload entry if static build
69 */
70 DEF_STATIC_JNI_OnLoad
71
72
73 // Throw an OutOfMemoryError with the given message.
74 static void throwOutOfMemoryError(JNIEnv *env, const char *msg)
75 {
76 static jclass exceptionClass = NULL;
77 jclass c;
78
79 (*env)->ExceptionClear(env); // If an exception is pending, clear it before
80 // calling FindClass() and/or ThrowNew().
81 if (exceptionClass) {
82 c = exceptionClass;
83 } else {
84 c = (*env)->FindClass(env, "java/lang/OutOfMemoryError");
85 if ((*env)->ExceptionOccurred(env)) return;
86 exceptionClass = (*env)->NewGlobalRef(env, c);
87 }
88
89 (*env)->ThrowNew(env, c, msg);
90 }
|