diff --git a/jnius/jnius_conversion.pxi b/jnius/jnius_conversion.pxi index 78e7931..9f2bd87 100644 --- a/jnius/jnius_conversion.pxi +++ b/jnius/jnius_conversion.pxi @@ -12,6 +12,11 @@ cdef void release_args(JNIEnv *j_env, tuple definition_args, jvalue *j_args, arg argtype in ('Ljava/lang/String;', 'Ljava/lang/Object;'): j_env[0].DeleteLocalRef(j_env, j_args[index].l) elif argtype[0] == '[': + ret = convert_jarray_to_python(j_env, argtype[1:], j_args[index].l) + try: + args[index][:] = ret + except TypeError: + pass j_env[0].DeleteLocalRef(j_env, j_args[index].l) diff --git a/tests/test_output_args.py b/tests/test_output_args.py new file mode 100644 index 0000000..e8f558e --- /dev/null +++ b/tests/test_output_args.py @@ -0,0 +1,11 @@ +import unittest +from jnius import autoclass + +class OutputArgs(unittest.TestCase): + + def test_string_output_args(self): + String = autoclass('java.lang.String') + string = String('word'.encode('utf-8')) + btarray= [0] * 4 + string.getBytes(0, 4, btarray, 0) + self.assertEquals(btarray, [119, 111, 114, 100])