Commit 70930a30 authored by Jan Starzynski's avatar Jan Starzynski

refactored throwJavaException() and removed useless returns

parent 925e4eec
...@@ -7,60 +7,27 @@ ...@@ -7,60 +7,27 @@
using namespace cv; using namespace cv;
/// throw java exception from std::exception, no logging /// throw java exception
static const char *throwJavaException(JNIEnv *env, const std::exception &e); static void throwJavaException(JNIEnv *env, const std::exception *e, const char *method);
static const char *throwJavaException(JNIEnv *env, const std::exception &e) { static void throwJavaException(JNIEnv *env, const std::exception *e, const char *method) {
const char *exception_str = "std::exception"; std::string what = "unknown exception";
jclass je = 0; jclass je = 0;
if(dynamic_cast<const cv::Exception*>(&e)) { if(e) {
exception_str = "cv::Exception"; std::string exception_type = "std::exception";
if(dynamic_cast<const cv::Exception*>(e)) {
exception_type = "cv::Exception";
je = env->FindClass("org/opencv/core/CvException"); je = env->FindClass("org/opencv/core/CvException");
} }
if(!je) je = env->FindClass("java/lang/Exception"); what = exception_type + ": " + e->what();
env->ThrowNew(je, e.what()); }
return exception_str;
}
/// throw java exception from unknown exception, no logging
static void throwJavaException(JNIEnv *env);
static void throwJavaException(JNIEnv *env) {
jclass je = env->FindClass("java/lang/Exception");
env->ThrowNew(je, "unknown exception");
}
/// throw java exception from std::exception, use LOGD
static void throwJavaExceptionD(JNIEnv *env, const std::exception &e, const char *method);
static void throwJavaExceptionD(JNIEnv *env, const std::exception &e, const char *method) {
const char *exception_str = throwJavaException(env, e);
LOGD("%s caught %s: %s", method, exception_str, e.what());
(void)method; // avoid "unused" warning
(void)exception_str; // avoid "unused" warning
}
/// throw java exception from unknown exception, use LOGD
static void throwJavaExceptionD(JNIEnv *env, const char *method);
static void throwJavaExceptionD(JNIEnv *env, const char *method) {
throwJavaException(env);
LOGD("%s caught unknown exception (...)", method);
(void)method; // avoid "unused" warning
}
/// throw java exception from std::exception, use LOGE if(!je) je = env->FindClass("java/lang/Exception");
static void throwJavaExceptionE(JNIEnv *env, const std::exception &e, const char *method); env->ThrowNew(je, what.c_str());
static void throwJavaExceptionE(JNIEnv *env, const std::exception &e, const char *method) {
const char *exception_str = throwJavaException(env, e);
LOGE("%s caught %s: %s", method, exception_str, e.what());
(void)method; // avoid "unused" warning
(void)exception_str; // avoid "unused" warning
}
/// throw java exception from unknown exception, use LOGE LOGE("%s caught %s", method, what.c_str());
static void throwJavaExceptionE(JNIEnv *env, const char *method);
static void throwJavaExceptionE(JNIEnv *env, const char *method) {
throwJavaException(env);
LOGE("%s caught unknown exception (...)", method);
(void)method; // avoid "unused" warning (void)method; // avoid "unused" warning
} }
...@@ -97,17 +64,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__III ...@@ -97,17 +64,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__III
static const char method_name[] = "Mat::n_1Mat__III()"; static const char method_name[] = "Mat::n_1Mat__III()";
try { try {
LOGD(method_name); LOGD(method_name);
return (jlong) new Mat( rows, cols, type );
Mat* _retval_ = new Mat( rows, cols, type );
return (jlong) _retval_;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -126,16 +90,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__DDI ...@@ -126,16 +90,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__DDI
try { try {
LOGD(method_name); LOGD(method_name);
Size size((int)size_width, (int)size_height); Size size((int)size_width, (int)size_height);
Mat* _retval_ = new Mat( size, type ); return (jlong) new Mat( size, type );
return (jlong) _retval_;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -155,16 +117,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__IIIDDDD ...@@ -155,16 +117,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__IIIDDDD
try { try {
LOGD(method_name); LOGD(method_name);
Scalar s(s_val0, s_val1, s_val2, s_val3); Scalar s(s_val0, s_val1, s_val2, s_val3);
Mat* _retval_ = new Mat( rows, cols, type, s ); return (jlong) new Mat( rows, cols, type, s );
return (jlong) _retval_;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -184,16 +144,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__DDIDDDD ...@@ -184,16 +144,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__DDIDDDD
LOGD(method_name); LOGD(method_name);
Size size((int)size_width, (int)size_height); Size size((int)size_width, (int)size_height);
Scalar s(s_val0, s_val1, s_val2, s_val3); Scalar s(s_val0, s_val1, s_val2, s_val3);
Mat* _retval_ = new Mat( size, type, s ); return (jlong) new Mat( size, type, s );
return (jlong) _retval_;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -213,16 +171,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__JIIII ...@@ -213,16 +171,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__JIIII
LOGD(method_name); LOGD(method_name);
Range rowRange(rowRange_start, rowRange_end); Range rowRange(rowRange_start, rowRange_end);
Range colRange(colRange_start, colRange_end); Range colRange(colRange_start, colRange_end);
Mat* _retval_ = new Mat( (*(Mat*)m_nativeObj), rowRange, colRange ); return (jlong) new Mat( (*(Mat*)m_nativeObj), rowRange, colRange );
return (jlong) _retval_;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -237,16 +193,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__JII ...@@ -237,16 +193,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1Mat__JII
try { try {
LOGD(method_name); LOGD(method_name);
Range rowRange(rowRange_start, rowRange_end); Range rowRange(rowRange_start, rowRange_end);
Mat* _retval_ = new Mat( (*(Mat*)m_nativeObj), rowRange ); return (jlong) new Mat( (*(Mat*)m_nativeObj), rowRange );
return (jlong) _retval_;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -265,15 +219,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1adjustROI ...@@ -265,15 +219,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1adjustROI
LOGD(method_name); LOGD(method_name);
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
Mat _retval_ = me->adjustROI( dtop, dbottom, dleft, dright ); Mat _retval_ = me->adjustROI( dtop, dbottom, dleft, dright );
return (jlong) new Mat(_retval_); return (jlong) new Mat(_retval_);
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -293,14 +246,10 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1assignTo__JJI ...@@ -293,14 +246,10 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1assignTo__JJI
LOGD(method_name); LOGD(method_name);
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
me->assignTo( (*(Mat*)m_nativeObj), type ); me->assignTo( (*(Mat*)m_nativeObj), type );
return;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return;
} }
} }
...@@ -316,14 +265,10 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1assignTo__JJ ...@@ -316,14 +265,10 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1assignTo__JJ
LOGD(method_name); LOGD(method_name);
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
me->assignTo( (*(Mat*)m_nativeObj) ); me->assignTo( (*(Mat*)m_nativeObj) );
return;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return;
} }
} }
...@@ -343,16 +288,14 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1channels ...@@ -343,16 +288,14 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1channels
try { try {
LOGD(method_name); LOGD(method_name);
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
int _retval_ = me->channels( ); return me->channels( );
return _retval_;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -371,16 +314,14 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1checkVector__JIIZ ...@@ -371,16 +314,14 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1checkVector__JIIZ
try { try {
LOGD(method_name); LOGD(method_name);
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
int _retval_ = me->checkVector( elemChannels, depth, requireContinuous ); return me->checkVector( elemChannels, depth, requireContinuous );
return _retval_;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -395,16 +336,14 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1checkVector__JII ...@@ -395,16 +336,14 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1checkVector__JII
try { try {
LOGD(method_name); LOGD(method_name);
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
int _retval_ = me->checkVector( elemChannels, depth ); return me->checkVector( elemChannels, depth );
return _retval_;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -419,16 +358,14 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1checkVector__JI ...@@ -419,16 +358,14 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1checkVector__JI
try { try {
LOGD(method_name); LOGD(method_name);
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
int _retval_ = me->checkVector( elemChannels ); return me->checkVector( elemChannels );
return _retval_;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -449,15 +386,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1clone ...@@ -449,15 +386,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1clone
LOGD(method_name); LOGD(method_name);
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
Mat _retval_ = me->clone( ); Mat _retval_ = me->clone( );
return (jlong) new Mat(_retval_); return (jlong) new Mat(_retval_);
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -477,15 +413,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1col ...@@ -477,15 +413,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1col
LOGD(method_name); LOGD(method_name);
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
Mat _retval_ = me->col( x ); Mat _retval_ = me->col( x );
return (jlong) new Mat(_retval_); return (jlong) new Mat(_retval_);
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -505,15 +440,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1colRange ...@@ -505,15 +440,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1colRange
LOGD(method_name); LOGD(method_name);
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
Mat _retval_ = me->colRange( startcol, endcol ); Mat _retval_ = me->colRange( startcol, endcol );
return (jlong) new Mat(_retval_); return (jlong) new Mat(_retval_);
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -532,16 +466,14 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1dims ...@@ -532,16 +466,14 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1dims
try { try {
LOGD(method_name); LOGD(method_name);
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
int _retval_ = me->dims; return me->dims;
return _retval_;
} catch(cv::Exception e) { } catch(cv::Exception e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -560,16 +492,14 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1cols ...@@ -560,16 +492,14 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1cols
try { try {
LOGD(method_name); LOGD(method_name);
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
int _retval_ = me->cols; return me->cols;
return _retval_;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -590,14 +520,10 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1convertTo__JJIDD ...@@ -590,14 +520,10 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1convertTo__JJIDD
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
Mat& m = *((Mat*)m_nativeObj); Mat& m = *((Mat*)m_nativeObj);
me->convertTo( m, rtype, alpha, beta ); me->convertTo( m, rtype, alpha, beta );
return;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return;
} }
} }
...@@ -614,14 +540,10 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1convertTo__JJID ...@@ -614,14 +540,10 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1convertTo__JJID
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
Mat& m = *((Mat*)m_nativeObj); Mat& m = *((Mat*)m_nativeObj);
me->convertTo( m, rtype, alpha ); me->convertTo( m, rtype, alpha );
return;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return;
} }
} }
...@@ -638,14 +560,10 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1convertTo__JJI ...@@ -638,14 +560,10 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1convertTo__JJI
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
Mat& m = *((Mat*)m_nativeObj); Mat& m = *((Mat*)m_nativeObj);
me->convertTo( m, rtype ); me->convertTo( m, rtype );
return;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return;
} }
} }
...@@ -667,14 +585,10 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1copyTo__JJ ...@@ -667,14 +585,10 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1copyTo__JJ
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
Mat& m = *((Mat*)m_nativeObj); Mat& m = *((Mat*)m_nativeObj);
me->copyTo( m ); me->copyTo( m );
return;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return;
} }
} }
...@@ -697,14 +611,10 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1copyTo__JJJ ...@@ -697,14 +611,10 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1copyTo__JJJ
Mat& m = *((Mat*)m_nativeObj); Mat& m = *((Mat*)m_nativeObj);
Mat& mask = *((Mat*)mask_nativeObj); Mat& mask = *((Mat*)mask_nativeObj);
me->copyTo( m, mask ); me->copyTo( m, mask );
return;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return;
} }
} }
...@@ -725,14 +635,10 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1create__JIII ...@@ -725,14 +635,10 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1create__JIII
LOGD(method_name); LOGD(method_name);
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
me->create( rows, cols, type ); me->create( rows, cols, type );
return;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return;
} }
} }
...@@ -754,14 +660,10 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1create__JDDI ...@@ -754,14 +660,10 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1create__JDDI
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
Size size((int)size_width, (int)size_height); Size size((int)size_width, (int)size_height);
me->create( size, type ); me->create( size, type );
return;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return;
} }
} }
...@@ -783,15 +685,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1cross ...@@ -783,15 +685,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1cross
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
Mat& m = *((Mat*)m_nativeObj); Mat& m = *((Mat*)m_nativeObj);
Mat _retval_ = me->cross( m ); Mat _retval_ = me->cross( m );
return (jlong) new Mat(_retval_); return (jlong) new Mat(_retval_);
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -827,16 +728,14 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1depth ...@@ -827,16 +728,14 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1depth
try { try {
LOGD(method_name); LOGD(method_name);
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
int _retval_ = me->depth( ); return me->depth( );
return _retval_;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -856,15 +755,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1diag__JI ...@@ -856,15 +755,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1diag__JI
LOGD(method_name); LOGD(method_name);
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
Mat _retval_ = me->diag( d ); Mat _retval_ = me->diag( d );
return (jlong) new Mat(_retval_); return (jlong) new Mat(_retval_);
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -883,17 +781,15 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1diag__J ...@@ -883,17 +781,15 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1diag__J
static const char method_name[] = "Mat::n_1diag__J()"; static const char method_name[] = "Mat::n_1diag__J()";
try { try {
LOGD(method_name); LOGD(method_name);
Mat _retval_ = Mat::diag( (*(Mat*)d_nativeObj) ); Mat _retval_ = Mat::diag( (*(Mat*)d_nativeObj) );
return (jlong) new Mat(_retval_); return (jlong) new Mat(_retval_);
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -913,16 +809,14 @@ JNIEXPORT jdouble JNICALL Java_org_opencv_core_Mat_n_1dot ...@@ -913,16 +809,14 @@ JNIEXPORT jdouble JNICALL Java_org_opencv_core_Mat_n_1dot
LOGD(method_name); LOGD(method_name);
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
Mat& m = *((Mat*)m_nativeObj); Mat& m = *((Mat*)m_nativeObj);
double _retval_ = me->dot( m ); return me->dot( m );
return _retval_;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -941,16 +835,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1elemSize ...@@ -941,16 +835,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1elemSize
try { try {
LOGD(method_name); LOGD(method_name);
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
size_t _retval_ = me->elemSize( ); return me->elemSize( );
return _retval_;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -969,16 +861,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1elemSize1 ...@@ -969,16 +861,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1elemSize1
try { try {
LOGD(method_name); LOGD(method_name);
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
size_t _retval_ = me->elemSize1( ); return me->elemSize1( );
return _retval_;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -997,16 +887,14 @@ JNIEXPORT jboolean JNICALL Java_org_opencv_core_Mat_n_1empty ...@@ -997,16 +887,14 @@ JNIEXPORT jboolean JNICALL Java_org_opencv_core_Mat_n_1empty
try { try {
LOGD(method_name); LOGD(method_name);
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
bool _retval_ = me->empty( ); return me->empty( );
return _retval_;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -1024,17 +912,15 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1eye__III ...@@ -1024,17 +912,15 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1eye__III
static const char method_name[] = "Mat::n_1eye__III()"; static const char method_name[] = "Mat::n_1eye__III()";
try { try {
LOGD(method_name); LOGD(method_name);
Mat _retval_ = Mat::eye( rows, cols, type ); Mat _retval_ = Mat::eye( rows, cols, type );
return (jlong) new Mat(_retval_); return (jlong) new Mat(_retval_);
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -1054,15 +940,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1eye__DDI ...@@ -1054,15 +940,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1eye__DDI
LOGD(method_name); LOGD(method_name);
Size size((int)size_width, (int)size_height); Size size((int)size_width, (int)size_height);
Mat _retval_ = Mat::eye( size, type ); Mat _retval_ = Mat::eye( size, type );
return (jlong) new Mat(_retval_); return (jlong) new Mat(_retval_);
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -1082,15 +967,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1inv__JI ...@@ -1082,15 +967,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1inv__JI
LOGD(method_name); LOGD(method_name);
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
Mat _retval_ = me->inv( method ); Mat _retval_ = me->inv( method );
return (jlong) new Mat(_retval_); return (jlong) new Mat(_retval_);
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -1105,15 +989,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1inv__J ...@@ -1105,15 +989,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1inv__J
LOGD(method_name); LOGD(method_name);
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
Mat _retval_ = me->inv( ); Mat _retval_ = me->inv( );
return (jlong) new Mat(_retval_); return (jlong) new Mat(_retval_);
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -1132,16 +1015,14 @@ JNIEXPORT jboolean JNICALL Java_org_opencv_core_Mat_n_1isContinuous ...@@ -1132,16 +1015,14 @@ JNIEXPORT jboolean JNICALL Java_org_opencv_core_Mat_n_1isContinuous
try { try {
LOGD(method_name); LOGD(method_name);
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
bool _retval_ = me->isContinuous( ); return me->isContinuous( );
return _retval_;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -1160,16 +1041,14 @@ JNIEXPORT jboolean JNICALL Java_org_opencv_core_Mat_n_1isSubmatrix ...@@ -1160,16 +1041,14 @@ JNIEXPORT jboolean JNICALL Java_org_opencv_core_Mat_n_1isSubmatrix
try { try {
LOGD(method_name); LOGD(method_name);
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
bool _retval_ = me->isSubmatrix( ); return me->isSubmatrix( );
return _retval_;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -1192,13 +1071,10 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_locateROI_10 ...@@ -1192,13 +1071,10 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_locateROI_10
Point ofs; Point ofs;
me->locateROI( wholeSize, ofs ); me->locateROI( wholeSize, ofs );
jdouble tmp_wholeSize[2] = {wholeSize.width, wholeSize.height}; env->SetDoubleArrayRegion(wholeSize_out, 0, 2, tmp_wholeSize); jdouble tmp_ofs[2] = {ofs.x, ofs.y}; env->SetDoubleArrayRegion(ofs_out, 0, 2, tmp_ofs); jdouble tmp_wholeSize[2] = {wholeSize.width, wholeSize.height}; env->SetDoubleArrayRegion(wholeSize_out, 0, 2, tmp_wholeSize); jdouble tmp_ofs[2] = {ofs.x, ofs.y}; env->SetDoubleArrayRegion(ofs_out, 0, 2, tmp_ofs);
return;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return;
} }
} }
...@@ -1220,15 +1096,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1mul__JJD ...@@ -1220,15 +1096,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1mul__JJD
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
Mat& m = *((Mat*)m_nativeObj); Mat& m = *((Mat*)m_nativeObj);
Mat _retval_ = me->mul( m, scale ); Mat _retval_ = me->mul( m, scale );
return (jlong) new Mat(_retval_); return (jlong) new Mat(_retval_);
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -1245,15 +1120,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1mul__JJ ...@@ -1245,15 +1120,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1mul__JJ
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
Mat& m = *((Mat*)m_nativeObj); Mat& m = *((Mat*)m_nativeObj);
Mat _retval_ = me->mul( m ); Mat _retval_ = me->mul( m );
return (jlong) new Mat(_retval_); return (jlong) new Mat(_retval_);
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -1271,17 +1145,15 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1ones__III ...@@ -1271,17 +1145,15 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1ones__III
static const char method_name[] = "Mat::n_1ones__III()"; static const char method_name[] = "Mat::n_1ones__III()";
try { try {
LOGD(method_name); LOGD(method_name);
Mat _retval_ = Mat::ones( rows, cols, type ); Mat _retval_ = Mat::ones( rows, cols, type );
return (jlong) new Mat(_retval_); return (jlong) new Mat(_retval_);
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -1301,15 +1173,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1ones__DDI ...@@ -1301,15 +1173,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1ones__DDI
LOGD(method_name); LOGD(method_name);
Size size((int)size_width, (int)size_height); Size size((int)size_width, (int)size_height);
Mat _retval_ = Mat::ones( size, type ); Mat _retval_ = Mat::ones( size, type );
return (jlong) new Mat(_retval_); return (jlong) new Mat(_retval_);
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -1329,14 +1200,10 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1push_1back ...@@ -1329,14 +1200,10 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1push_1back
LOGD(method_name); LOGD(method_name);
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
me->push_back( (*(Mat*)m_nativeObj) ); me->push_back( (*(Mat*)m_nativeObj) );
return;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return;
} }
} }
...@@ -1357,14 +1224,10 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1release ...@@ -1357,14 +1224,10 @@ JNIEXPORT void JNICALL Java_org_opencv_core_Mat_n_1release
LOGD(method_name); LOGD(method_name);
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
me->release( ); me->release( );
return;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return;
} }
} }
...@@ -1385,15 +1248,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1reshape__JII ...@@ -1385,15 +1248,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1reshape__JII
LOGD(method_name); LOGD(method_name);
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
Mat _retval_ = me->reshape( cn, rows ); Mat _retval_ = me->reshape( cn, rows );
return (jlong) new Mat(_retval_); return (jlong) new Mat(_retval_);
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -1409,15 +1271,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1reshape__JI ...@@ -1409,15 +1271,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1reshape__JI
LOGD(method_name); LOGD(method_name);
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
Mat _retval_ = me->reshape( cn ); Mat _retval_ = me->reshape( cn );
return (jlong) new Mat(_retval_); return (jlong) new Mat(_retval_);
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -1437,15 +1298,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1row ...@@ -1437,15 +1298,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1row
LOGD(method_name); LOGD(method_name);
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
Mat _retval_ = me->row( y ); Mat _retval_ = me->row( y );
return (jlong) new Mat(_retval_); return (jlong) new Mat(_retval_);
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -1465,15 +1325,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1rowRange ...@@ -1465,15 +1325,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1rowRange
LOGD(method_name); LOGD(method_name);
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
Mat _retval_ = me->rowRange( startrow, endrow ); Mat _retval_ = me->rowRange( startrow, endrow );
return (jlong) new Mat(_retval_); return (jlong) new Mat(_retval_);
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -1492,16 +1351,14 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1rows ...@@ -1492,16 +1351,14 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1rows
try { try {
LOGD(method_name); LOGD(method_name);
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
int _retval_ = me->rows; return me->rows;
return _retval_;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -1522,15 +1379,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1setTo__JDDDD ...@@ -1522,15 +1379,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1setTo__JDDDD
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
Scalar s(s_val0, s_val1, s_val2, s_val3); Scalar s(s_val0, s_val1, s_val2, s_val3);
Mat _retval_ = me->operator =( s ); Mat _retval_ = me->operator =( s );
return (jlong) new Mat(_retval_); return (jlong) new Mat(_retval_);
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -1552,15 +1408,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1setTo__JDDDDJ ...@@ -1552,15 +1408,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1setTo__JDDDDJ
Scalar s(s_val0, s_val1, s_val2, s_val3); Scalar s(s_val0, s_val1, s_val2, s_val3);
Mat& mask = *((Mat*)mask_nativeObj); Mat& mask = *((Mat*)mask_nativeObj);
Mat _retval_ = me->setTo( s, mask ); Mat _retval_ = me->setTo( s, mask );
return (jlong) new Mat(_retval_); return (jlong) new Mat(_retval_);
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -1582,15 +1437,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1setTo__JJJ ...@@ -1582,15 +1437,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1setTo__JJJ
Mat& value = *((Mat*)value_nativeObj); Mat& value = *((Mat*)value_nativeObj);
Mat& mask = *((Mat*)mask_nativeObj); Mat& mask = *((Mat*)mask_nativeObj);
Mat _retval_ = me->setTo( value, mask ); Mat _retval_ = me->setTo( value, mask );
return (jlong) new Mat(_retval_); return (jlong) new Mat(_retval_);
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -1607,15 +1461,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1setTo__JJ ...@@ -1607,15 +1461,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1setTo__JJ
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
Mat& value = *((Mat*)value_nativeObj); Mat& value = *((Mat*)value_nativeObj);
Mat _retval_ = me->setTo( value ); Mat _retval_ = me->setTo( value );
return (jlong) new Mat(_retval_); return (jlong) new Mat(_retval_);
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -1635,15 +1488,17 @@ JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Mat_n_1size ...@@ -1635,15 +1488,17 @@ JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Mat_n_1size
LOGD(method_name); LOGD(method_name);
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
Size _retval_ = me->size( ); Size _retval_ = me->size( );
jdoubleArray _da_retval_ = env->NewDoubleArray(2); jdouble _tmp_retval_[2] = {_retval_.width, _retval_.height}; env->SetDoubleArrayRegion(_da_retval_, 0, 2, _tmp_retval_); jdoubleArray _da_retval_ = env->NewDoubleArray(2);
jdouble _tmp_retval_[2] = {_retval_.width, _retval_.height};
env->SetDoubleArrayRegion(_da_retval_, 0, 2, _tmp_retval_);
return _da_retval_; return _da_retval_;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -1662,16 +1517,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1step1__JI ...@@ -1662,16 +1517,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1step1__JI
try { try {
LOGD(method_name); LOGD(method_name);
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
size_t _retval_ = me->step1( i ); return me->step1( i );
return _retval_;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -1686,16 +1539,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1step1__J ...@@ -1686,16 +1539,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1step1__J
try { try {
LOGD(method_name); LOGD(method_name);
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
size_t _retval_ = me->step1( ); return me->step1( );
return _retval_;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
// //
...@@ -1715,15 +1566,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1submat_1rr ...@@ -1715,15 +1566,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1submat_1rr
Range rowRange(rowRange_start, rowRange_end); Range rowRange(rowRange_start, rowRange_end);
Range colRange(colRange_start, colRange_end); Range colRange(colRange_start, colRange_end);
Mat _retval_ = me->operator()( rowRange, colRange ); Mat _retval_ = me->operator()( rowRange, colRange );
return (jlong) new Mat(_retval_); return (jlong) new Mat(_retval_);
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -1744,15 +1594,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1submat ...@@ -1744,15 +1594,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1submat
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
Rect roi(roi_x, roi_y, roi_width, roi_height); Rect roi(roi_x, roi_y, roi_width, roi_height);
Mat _retval_ = me->operator()( roi ); Mat _retval_ = me->operator()( roi );
return (jlong) new Mat(_retval_); return (jlong) new Mat(_retval_);
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -1772,15 +1621,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1t ...@@ -1772,15 +1621,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1t
LOGD(method_name); LOGD(method_name);
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
Mat _retval_ = me->t( ); Mat _retval_ = me->t( );
return (jlong) new Mat(_retval_); return (jlong) new Mat(_retval_);
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -1799,16 +1647,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1total ...@@ -1799,16 +1647,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1total
try { try {
LOGD(method_name); LOGD(method_name);
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
size_t _retval_ = me->total( ); return me->total( );
return _retval_;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -1827,16 +1673,14 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1type ...@@ -1827,16 +1673,14 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_n_1type
try { try {
LOGD(method_name); LOGD(method_name);
Mat* me = (Mat*) self; //TODO: check for NULL Mat* me = (Mat*) self; //TODO: check for NULL
int _retval_ = me->type( ); return me->type( );
return _retval_;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -1854,17 +1698,15 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1zeros__III ...@@ -1854,17 +1698,15 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1zeros__III
static const char method_name[] = "Mat::n_1zeros__III()"; static const char method_name[] = "Mat::n_1zeros__III()";
try { try {
LOGD(method_name); LOGD(method_name);
Mat _retval_ = Mat::zeros( rows, cols, type ); Mat _retval_ = Mat::zeros( rows, cols, type );
return (jlong) new Mat(_retval_); return (jlong) new Mat(_retval_);
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -1884,15 +1726,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1zeros__DDI ...@@ -1884,15 +1726,14 @@ JNIEXPORT jlong JNICALL Java_org_opencv_core_Mat_n_1zeros__DDI
LOGD(method_name); LOGD(method_name);
Size size((int)size_width, (int)size_height); Size size((int)size_width, (int)size_height);
Mat _retval_ = Mat::zeros( size, type ); Mat _retval_ = Mat::zeros( size, type );
return (jlong) new Mat(_retval_); return (jlong) new Mat(_retval_);
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -1963,12 +1804,12 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutD ...@@ -1963,12 +1804,12 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutD
env->ReleasePrimitiveArrayCritical(vals, values, 0); env->ReleasePrimitiveArrayCritical(vals, values, 0);
return res; return res;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -2026,12 +1867,12 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutB ...@@ -2026,12 +1867,12 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutB
env->ReleasePrimitiveArrayCritical(vals, values, 0); env->ReleasePrimitiveArrayCritical(vals, values, 0);
return res; return res;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutS JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutS
...@@ -2053,12 +1894,12 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutS ...@@ -2053,12 +1894,12 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutS
env->ReleasePrimitiveArrayCritical(vals, values, 0); env->ReleasePrimitiveArrayCritical(vals, values, 0);
return res; return res;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutI JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutI
...@@ -2080,12 +1921,12 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutI ...@@ -2080,12 +1921,12 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutI
env->ReleasePrimitiveArrayCritical(vals, values, 0); env->ReleasePrimitiveArrayCritical(vals, values, 0);
return res; return res;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutF JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutF
...@@ -2107,12 +1948,12 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutF ...@@ -2107,12 +1948,12 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nPutF
env->ReleasePrimitiveArrayCritical(vals, values, 0); env->ReleasePrimitiveArrayCritical(vals, values, 0);
return res; return res;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
...@@ -2169,12 +2010,12 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetB ...@@ -2169,12 +2010,12 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetB
env->ReleasePrimitiveArrayCritical(vals, values, 0); env->ReleasePrimitiveArrayCritical(vals, values, 0);
return res; return res;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetS JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetS
...@@ -2196,12 +2037,12 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetS ...@@ -2196,12 +2037,12 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetS
env->ReleasePrimitiveArrayCritical(vals, values, 0); env->ReleasePrimitiveArrayCritical(vals, values, 0);
return res; return res;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetI JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetI
...@@ -2223,12 +2064,12 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetI ...@@ -2223,12 +2064,12 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetI
env->ReleasePrimitiveArrayCritical(vals, values, 0); env->ReleasePrimitiveArrayCritical(vals, values, 0);
return res; return res;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetF JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetF
...@@ -2250,12 +2091,12 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetF ...@@ -2250,12 +2091,12 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetF
env->ReleasePrimitiveArrayCritical(vals, values, 0); env->ReleasePrimitiveArrayCritical(vals, values, 0);
return res; return res;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetD JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetD
...@@ -2277,12 +2118,12 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetD ...@@ -2277,12 +2118,12 @@ JNIEXPORT jint JNICALL Java_org_opencv_core_Mat_nGetD
env->ReleasePrimitiveArrayCritical(vals, values, 0); env->ReleasePrimitiveArrayCritical(vals, values, 0);
return res; return res;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Mat_nGet JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Mat_nGet
...@@ -2315,12 +2156,12 @@ JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Mat_nGet ...@@ -2315,12 +2156,12 @@ JNIEXPORT jdoubleArray JNICALL Java_org_opencv_core_Mat_nGet
} }
return res; return res;
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionD(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionD(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
JNIEXPORT jstring JNICALL Java_org_opencv_core_Mat_nDump JNIEXPORT jstring JNICALL Java_org_opencv_core_Mat_nDump
...@@ -2338,12 +2179,12 @@ JNIEXPORT jstring JNICALL Java_org_opencv_core_Mat_nDump ...@@ -2338,12 +2179,12 @@ JNIEXPORT jstring JNICALL Java_org_opencv_core_Mat_nDump
std::string str = s.str(); std::string str = s.str();
return env->NewStringUTF(str.c_str()); return env->NewStringUTF(str.c_str());
} catch(const std::exception &e) { } catch(const std::exception &e) {
throwJavaExceptionE(env, e, method_name); throwJavaException(env, &e, method_name);
return 0;
} catch (...) { } catch (...) {
throwJavaExceptionE(env, method_name); throwJavaException(env, 0, method_name);
return 0;
} }
return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment