1 /******************************************************************
3 * Copyright 2015 Samsung Electronics All Rights Reserved.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
19 ******************************************************************/
20 #include "simulator_jni_utils.h"
21 #include "simulator_common_jni.h"
23 extern SimulatorClassRefs gSimulatorClassRefs;
25 void throwSimulatorException(JNIEnv *env, SimulatorResult errCode, const char *errMessage)
27 jobject ex = env->NewObject(gSimulatorClassRefs.classSimulatorException,
28 gSimulatorClassRefs.classSimulatorExceptionCtor, errCode,
29 env->NewStringUTF(errMessage));
34 env->Throw((jthrowable)ex);
37 void throwInvalidArgsException(JNIEnv *env, SimulatorResult errCode, const char *errMessage)
39 jobject ex = env->NewObject(gSimulatorClassRefs.classInvalidArgsException,
40 gSimulatorClassRefs.classInvalidArgsExceptionCtor, errCode,
41 env->NewStringUTF(errMessage));
46 env->Throw((jthrowable)ex);
49 void throwNoSupportException(JNIEnv *env, SimulatorResult errCode, const char *errMessage)
51 jobject ex = env->NewObject(gSimulatorClassRefs.classNoSupportException,
52 gSimulatorClassRefs.classNoSupportExceptionCtor, errCode,
53 env->NewStringUTF(errMessage));
58 env->Throw((jthrowable)ex);
61 void throwOperationInProgressException(JNIEnv *env, SimulatorResult errCode, const char *errMessage)
63 jobject ex = env->NewObject(gSimulatorClassRefs.classOperationInProgressException,
64 gSimulatorClassRefs.classOperationInProgressExceptionCtor, errCode,
65 env->NewStringUTF(errMessage));
70 env->Throw((jthrowable)ex);