diff --git a/Lib/java/std_string.i b/Lib/java/std_string.i index 31aef1338..7237cdda8 100644 --- a/Lib/java/std_string.i +++ b/Lib/java/std_string.i @@ -57,6 +57,11 @@ class string; %typemap(typecheck) string = char *; +%typemap(throws) string %{ + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, $1.c_str()); + return $null; +%} + // const string & %typemap(jni) const string & "jstring" %typemap(jtype) const string & "String" @@ -94,6 +99,11 @@ class string; %typemap(typecheck) const string & = char *; +%typemap(throws) const string & %{ + SWIG_JavaThrowException(jenv, SWIG_JavaRuntimeException, $1.c_str()); + return $null; +%} + } /* ------------------------------------------------------------------------