1 /* -----------------------------------------------------------------------------
2 * See the LICENSE file for information on copyright, usage and redistribution
3 * of SWIG, and the README file for authors - http://www.swig.org/release.html.
8 * ----------------------------------------------------------------------------- */
19 /* Support for throwing Modula3 exceptions */
21 SWIG_JavaOutOfMemoryError = 1,
23 SWIG_JavaRuntimeException,
24 SWIG_JavaIndexOutOfBoundsException,
25 SWIG_JavaArithmeticException,
26 SWIG_JavaIllegalArgumentException,
27 SWIG_JavaNullPointerException,
29 } SWIG_JavaExceptionCodes;
32 SWIG_JavaExceptionCodes code;
33 const char *java_exception;
34 } SWIG_JavaExceptions_t;
36 #if defined(SWIG_NOINCLUDE)
37 void SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg);
41 void SWIG_JavaThrowException(JNIEnv *jenv, SWIG_JavaExceptionCodes code, const char *msg) {
43 static const SWIG_JavaExceptions_t java_exceptions[] = {
44 { SWIG_JavaOutOfMemoryError, "java/lang/OutOfMemoryError" },
45 { SWIG_JavaIOException, "java/io/IOException" },
46 { SWIG_JavaRuntimeException, "java/lang/RuntimeException" },
47 { SWIG_JavaIndexOutOfBoundsException, "java/lang/IndexOutOfBoundsException" },
48 { SWIG_JavaArithmeticException, "java/lang/ArithmeticException" },
49 { SWIG_JavaIllegalArgumentException, "java/lang/IllegalArgumentException" },
50 { SWIG_JavaNullPointerException, "java/lang/NullPointerException" },
51 { SWIG_JavaUnknownError, "java/lang/UnknownError" },
52 { (SWIG_JavaExceptionCodes)0, "java/lang/UnknownError" } };
53 const SWIG_JavaExceptions_t *except_ptr = java_exceptions;
55 while (except_ptr->code != code && except_ptr->code)
58 JCALL0(ExceptionClear, jenv);
59 excep = JCALL1(FindClass, jenv, except_ptr->java_exception);
61 JCALL2(ThrowNew, jenv, excep, msg);