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

Fix call to findResources returns empty. #837

Merged
merged 2 commits into from
Oct 3, 2023

Conversation

lushangkan
Copy link
Contributor

Fix the issue that findResources returns empty due to not overriding findResources.
Added getUrlLoader() to allow developers to access other URLClassLoader methods that are not overridden by KnotClassLoader.

@liach liach requested a review from a team September 26, 2023 16:49
@liach liach added the bug label Sep 26, 2023
public Enumeration<URL> findResources(String name) throws IOException {
Objects.requireNonNull(name);

return urlLoader.findResources(name);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this not also include any results from originalLoader? Or at least if urlLoader doesn't return any results, like getResources does below.

Copy link
Contributor

Choose a reason for hiding this comment

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

This current implementation is consistent with findResource(String).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This current implementation is consistent with findResource(String).

When multiple Models contain resources with the same path, findResource can only display one of them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should this not also include any results from originalLoader? Or at least if urlLoader doesn't return any results, like getResources does below.

My understanding is that findResource and findResources are designed to find resources within the current ClassLoader implementation, while getResource is designed to query the parent ClassLoader and query within the current ClassLoader.

You can see that the findResources implemented by URLClassLoader does not query the results of the parent ClassLoader.

@modmuss50 modmuss50 merged commit 222f297 into FabricMC:master Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants