| 28 | "java/lang/UnsupportedOperationException"; |
| 29 | |
| 30 | void throwException(JNIEnv* env, const char* clazz, const char* fmt, ...) { |
| 31 | va_list args; |
| 32 | va_start(args, fmt); |
| 33 | // Using vsnprintf() instead of vasprintf() because the latter doesn't seem to |
| 34 | // be easily available on Windows. |
| 35 | const size_t max_msg_len = 512; |
| 36 | char* message = static_cast<char*>(malloc(max_msg_len)); |
| 37 | if (vsnprintf(message, max_msg_len, fmt, args) >= 0) { |
| 38 | env->ThrowNew(env->FindClass(clazz), message); |
| 39 | } else { |
| 40 | env->ThrowNew(env->FindClass(clazz), ""); |
| 41 | } |
| 42 | free(message); |
| 43 | va_end(args); |
| 44 | } |
| 45 | |
| 46 | namespace { |
| 47 | // Map TF_Codes to unchecked exceptions. |
no outgoing calls
no test coverage detected