Skip to content
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

log the plugin loading NoClassDefFoundError #287

Merged
merged 3 commits into from
Jul 10, 2023

Conversation

yaozhihang
Copy link
Member

Fix the issue
#285

@yaozhihang yaozhihang self-assigned this Jul 7, 2023
@clausnagel
Copy link
Member

Thanks, @yaozhihang. Couldn't we alternatively just log exceptions for those plugins that cannot be loaded (via something like addException) and load those plugins that can be loaded?

for (Plugin plugin : pluginLoader) {
plugins.add(plugin);
}
} catch (NoClassDefFoundError e) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest catching Throwable here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done with 952a7fd

@yaozhihang
Copy link
Member Author

Hm, i think not possible. The exception is thrown in the method hasNextService of the ServiceLoader and no plugin info is returned. You have ideas?

@clausnagel
Copy link
Member

clausnagel commented Jul 10, 2023

Hm, i think not possible. The exception is thrown in the method hasNextService of the ServiceLoader and no plugin info is returned. You have ideas?

I also tested the iterator interface of the ServiceLoader and unfortunately the error is already thrown in the hasNext instead of the next method. So I can confirm that it's not really possible to skip just those plugins with errors and load the others.

I nevertheless propose a small change. I think it would be better to use the exception handling of the PluginManager class. This way, the CLI fails on errors (default behaviour), while the error is shown in the console window when using the GUI.

proposal.patch

@yaozhihang
Copy link
Member Author

Hm, i think not possible. The exception is thrown in the method hasNextService of the ServiceLoader and no plugin info is returned. You have ideas?

I also tested the iterator interface of the ServiceLoader and unfortunately the error is already thrown in the hasNext instead of the next method. So I can confirm that it's not really possible to skip just those plugins with errors and load the others.

I nevertheless propose a small change. I think it would be better to use the exception handling of the PluginManager class. This way, the CLI fails on errors (default behaviour), while the error is shown in the console window when using the GUI.

proposal.patch

thanks @clausnagel. The Proposal is in this commit d7ff2c3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants