-
Notifications
You must be signed in to change notification settings - Fork 73
Include the cause when a plugin fails to be instantiated #1471
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
base: main
Are you sure you want to change the base?
Include the cause when a plugin fails to be instantiated #1471
Conversation
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.
+1
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.
+1
Actually, I think we need something better than this. The issue we ran into that required this change was actually when a charset plugin threw a NullPointerException. In this case, the core exception was nested 3 exceptions deep, so looking at just the first cause wasn't enough. Additionally, even if we traversed to the bottom cause, the NullPointerException message doesn't help to let us know where the exception actually occurred, we really need the stack trace. So I've changed this so that it outputs the original message at the warning level and outputs the full stacktrack at the debug level. This maintains the current behavior of a simple warning that can be easily ignored, but allows devs to get the full stack trace if needed. Does this approach seem reasonable? Another option is to just always output the stack trace, but it can be pretty verbose and in some cases it might not actually matter. |
This issue of a cause in side a cause inside another cause, and which one you want a stacktrace from, is quite problematic. If the message says "Stack trace available in debug mode. See xyzzy." and there are instructions about how to enable debug somewhere, then that's about best we can do. |
9fccaf9
to
b295f35
Compare
If a UDF, charset, or layer plugin fails to be instantiated because and exception is thrown when loading, then we get a pretty helpful message, like: Named service XYZ failed to load. Cause: Provider XYZ could not be instantiated This provides no useful information as to the underlying cause why the provider could not be instantiated, so is very difficult to track down and fix. When this kind of error occurs, Java throws a ServiceConfigurationError exception and includes the underlying exception as the cause. This changes the logging message so we include the cause if one exists. This should make it a little easier for users to figure out why their plugin failed to load. DAFFODIL-2989
b295f35
to
e0bb3b6
Compare
If a UDF, charset, or layer plugin fails to be instantiated because and exception is thrown when loading, then we get a pretty helpful message, like:
Named service XYZ failed to load. Cause: Provider XYZ could not be instantiated
This provides no useful information as to the underlying cause why the provider could not be instantiated, so is very difficult to track down and fix.
When this kind of error occurs, Java throws a ServiceConfigurationError exception and includes the underlying exception as the cause. This changes the logging message so we include the cause if one exists. This should make it a little easier for users to figure out why their plugin failed to load.
DAFFODIL-2989