diff --git a/CHANGELOG.md b/CHANGELOG.md index 09420460..878a8e36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ + * Prevent `Generator` from swallowing exceptions caught on `Buffer.array()` ([pull #504](https://github.com/bytedeco/javacpp/pull/504)) * Add `enum` classes missing from config files required by GraalVM Native Image * Let `Parser` annotate `&&` parameters with new `@ByRef(true)` value used by `Generator` to call `std::move()` * Fix `Parser` overlooking anonymous `class`, `struct` or `union` with comments after `}` ([issue #501](https://github.com/bytedeco/javacpp/issues/501)) diff --git a/src/main/java/org/bytedeco/javacpp/tools/Generator.java b/src/main/java/org/bytedeco/javacpp/tools/Generator.java index 32d3186a..e7997fed 100644 --- a/src/main/java/org/bytedeco/javacpp/tools/Generator.java +++ b/src/main/java/org/bytedeco/javacpp/tools/Generator.java @@ -2237,7 +2237,7 @@ void parametersBefore(MethodInformation methodInfo) { out.println(" arr" + j + " = (j" + paramNameLowerCase + "Array)env->CallObjectMethod(arg" + j + ", JavaCPP_arrayMID);"); out.println(" offset" + j + " = env->CallIntMethod(arg" + j + ", JavaCPP_arrayOffsetMID);"); out.println(" if (env->ExceptionOccurred() != NULL) {"); - out.println(" env->ExceptionClear();"); + out.println(" return" + (methodInfo.returnType == void.class ? ";" : " 0;")); out.println(" } else {"); if (methodInfo.criticalRegion) { out.println(" ptr" + j + " = arr" + j + " == NULL ? NULL : (" + typeName[0] + typeName[1]