-
Notifications
You must be signed in to change notification settings - Fork 114
fix<data converter>: fail open on exception not found #1027
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix<data converter>: fail open on exception not found #1027
Conversation
classType = Class.forName(className); | ||
} catch (ClassNotFoundException e) { | ||
throw new IOException("Cannot deserialize " + className + " exception", e); | ||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than returning null we should return some generic Exception type (indicating that we couldn't deserialize it) or try and deserialize the Exception as some type that we know.
For example, we could introduce an ApplicationFailureException
, set classType = ApplicationFailureException.class
, and deserialize the json object into that.
… converter Signed-off-by: Shijie Sheng <liouvetren@gmail.com>
…ack on this exception instead Signed-off-by: Shijie Sheng <liouvetren@gmail.com>
87f15a1
to
700479d
Compare
classType = Class.forName(className); | ||
} catch (ClassNotFoundException e) { | ||
throw new IOException("Cannot deserialize " + className + " exception", e); | ||
return (T) new ApplicationFailureException("Class not found: " + className); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think doing classType = ApplicationFailureException.class
is more useful to the user. They'll still get their original stacktrace and everything, just with a different type of exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed
Signed-off-by: Shijie Sheng <liouvetren@gmail.com>
01dbd13
to
0705365
Compare
What changed?
Default data converter would throw I/O exception and thus fail workflow processing if the exception no longer exists. This PR changes the behavior by return null instead.
Why?
In V4, thrift exceptions will be removed and thus this is needed to avoid breaking existing workflows.
How did you test it?
Unit Test
Potential risks
Release notes
Documentation Changes