X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ef33b9c0c2c0e9c15c27fce82515a23e8aadc0ed..f690616d2664e4eca273b47be00c23258a33d813:/src/bindings/java/jxbt_utilities.cpp diff --git a/src/bindings/java/jxbt_utilities.cpp b/src/bindings/java/jxbt_utilities.cpp index 885d9d5f9e..ba5d746554 100644 --- a/src/bindings/java/jxbt_utilities.cpp +++ b/src/bindings/java/jxbt_utilities.cpp @@ -1,17 +1,17 @@ /* Various JNI helper functions */ -/* Copyright (c) 2007-2014. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#include /* abort */ -#include "xbt/misc.h" #include "xbt/sysdep.h" -#include "xbt/str.h" #include "jxbt_utilities.h" +#include /* abort */ + +SG_BEGIN_DECL() + jclass jxbt_get_class(JNIEnv * env, const char *name) { jclass cls = env->FindClass(name); @@ -20,7 +20,7 @@ jclass jxbt_get_class(JNIEnv * env, const char *name) char *m = bprintf("Class %s not found", name); jxbt_throw_jni(env, m); free(m); - return NULL; + return nullptr; } return cls; @@ -37,7 +37,7 @@ jmethodID jxbt_get_jmethod(JNIEnv * env, jclass cls, const char *name, const cha if (!id) { jmethodID tostr_id = env->GetMethodID(cls, "getName", "()Ljava/lang/String;"); - jstring jclassname = (jstring) env->CallObjectMethod(cls, tostr_id, NULL); + jstring jclassname = (jstring) env->CallObjectMethod(cls, tostr_id, nullptr); const char *classname = env->GetStringUTFChars(jclassname, 0); char *m = bprintf("Cannot find method %s(%s) in %s", name, signature, classname); @@ -63,7 +63,7 @@ jmethodID jxbt_get_static_jmethod(JNIEnv * env, jclass cls, const char *name, co if (!id) { jmethodID tostr_id = env->GetMethodID(cls, "getName", "()Ljava/lang/String;"); - jstring jclassname = (jstring) env->CallObjectMethod(cls, tostr_id, NULL); + jstring jclassname = (jstring) env->CallObjectMethod(cls, tostr_id, nullptr); const char *classname = env->GetStringUTFChars(jclassname, 0); char *m = bprintf("Cannot find static method %s(%s) in %s", name, signature, classname); @@ -134,7 +134,7 @@ jfieldID jxbt_get_jfield(JNIEnv * env, jclass cls, const char *name, const char if (!id) { jmethodID getname_id = env->GetMethodID(cls, "getName", "()Ljava/lang/String;"); - jstring jclassname = (jstring) env->CallObjectMethod(cls, getname_id, NULL); + jstring jclassname = (jstring) env->CallObjectMethod(cls, getname_id, nullptr); const char *classname = env->GetStringUTFChars(jclassname, 0); char *m = bprintf("Cannot find field %s %s in %s", signature, name, classname); @@ -192,11 +192,6 @@ void jxbt_throw_notbound(JNIEnv * env, const char *kind, void *pointer) jxbt_throw_by_name(env, "org/simgrid/msg/JniException", bprintf("Internal error: %s %p not bound", kind, pointer)); } -void jxbt_throw_native(JNIEnv * env, char *msg) -{ - jxbt_throw_by_name(env, "org/simgrid/msg/NativeException", msg); -} - void jxbt_throw_null(JNIEnv * env, char *msg) { jxbt_throw_by_name(env, "java/lang/NullPointerException", msg); @@ -241,3 +236,5 @@ void jxbt_throw_task_cancelled(JNIEnv * env, char *details) { jxbt_throw_by_name(env, "org/simgrid/msg/TaskCancelledException", details); } + +SG_END_DECL()