diff --git a/java/src/main/java/org/astonbitecode/j4rs/utils/Utils.java b/java/src/main/java/org/astonbitecode/j4rs/utils/Utils.java index 612df4e..7a705c0 100644 --- a/java/src/main/java/org/astonbitecode/j4rs/utils/Utils.java +++ b/java/src/main/java/org/astonbitecode/j4rs/utils/Utils.java @@ -16,9 +16,11 @@ import java.io.PrintWriter; import java.io.StringWriter; +import java.lang.reflect.InvocationTargetException; import java.util.Arrays; import org.astonbitecode.j4rs.api.dtos.GeneratedArg; +import org.astonbitecode.j4rs.errors.InvocationException; public class Utils { @@ -74,7 +76,12 @@ public static String throwableToString(Throwable throwable) { if (throwable != null) { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); - throwable.printStackTrace(pw); + if (throwable != null && throwable instanceof InvocationException + && throwable.getCause() != null && throwable.getCause() instanceof InvocationTargetException) { + throwable.getCause().getCause().printStackTrace(pw); + } else { + throwable.printStackTrace(pw); + } return sw.toString(); } else { return "Cannot create String out of a null Throwable"; diff --git a/rust/jassets/j4rs-0.19.0-SNAPSHOT-jar-with-dependencies.jar b/rust/jassets/j4rs-0.19.0-SNAPSHOT-jar-with-dependencies.jar index a6d9531..ce63c29 100644 Binary files a/rust/jassets/j4rs-0.19.0-SNAPSHOT-jar-with-dependencies.jar and b/rust/jassets/j4rs-0.19.0-SNAPSHOT-jar-with-dependencies.jar differ diff --git a/rust/src/utils.rs b/rust/src/utils.rs index f14ebc8..16e0e9e 100644 --- a/rust/src/utils.rs +++ b/rust/src/utils.rs @@ -134,6 +134,7 @@ fn find_j4rs_dynamic_libraries_dir_entries() -> errors::Result let file_name = entry.file_name(); let file_name = file_name.to_str().unwrap(); file_name.contains("j4rs") + && !file_name.contains("derive") && (file_name.contains(".so") || file_name.contains(".dll") || file_name.contains(".dylib"))