da-daken commented on code in PR #926:
URL: https://github.com/apache/flink-agents/pull/926#discussion_r3792073456
##########
runtime/src/main/java/org/apache/flink/agents/runtime/context/RunnerContextImpl.java:
##########
@@ -332,6 +352,23 @@ public static DurableExecutionException
fromException(Exception e) {
}
public Exception toException() {
+ if (exceptionClass == null) {
+ return new RuntimeException(message);
+ }
+ try {
+ Class<?> clazz = Class.forName(exceptionClass);
+ if (Exception.class.isAssignableFrom(clazz)) {
+ @SuppressWarnings("unchecked")
+ Class<? extends Exception> exceptionClazz = (Class<?
extends Exception>) clazz;
+ try {
+ return
exceptionClazz.getConstructor(String.class).newInstance(message);
+ } catch (NoSuchMethodException ignored) {
+ return exceptionClazz.getConstructor().newInstance();
Review Comment:
Good catch. I verified this issue in
`testDurableExecutionExceptionUsesContextClassLoader` and confirmed that it is
indeed problematic. I have added a fix in the new commit to properly load using
the user thread's classLoader.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]