| // | |
| // This file is auto-generated. Please don't modify it! | |
| // | |
| $includes | |
| using namespace cv; | |
| /// throw java exception | |
| static void throwJavaException(JNIEnv *env, const std::exception *e, const char *method) { | |
| std::string what = "unknown exception"; | |
| jclass je = 0; | |
| if(e) { | |
| std::string exception_type = "std::exception"; | |
| if(dynamic_cast<const cv::Exception*>(e)) { | |
| exception_type = "cv::Exception"; | |
| je = env->FindClass("org/opencv/core/CvException"); | |
| } | |
| what = exception_type + ": " + e->what(); | |
| } | |
| if(!je) je = env->FindClass("java/lang/Exception"); | |
| env->ThrowNew(je, what.c_str()); | |
| LOGE("%s caught %s", method, what.c_str()); | |
| (void)method; // avoid "unused" warning | |
| } | |
| extern "C" { | |
| $code | |
| } // extern "C" | |