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: custom URLClassLoaders are now actually used #3818

Merged
merged 4 commits into from
Mar 9, 2021

Conversation

andrewbwogi
Copy link
Contributor

closes #3789

@monperrus
Copy link
Collaborator

Thanks a lot @andrewbwogi, could you add a test case reproducing the bug?

@andrewbwogi andrewbwogi changed the title fix: fix StandardEnvironment so that custom URLClassLoaders are actually used wip: fix StandardEnvironment so that custom URLClassLoaders are actually used Mar 5, 2021
@andrewbwogi andrewbwogi changed the title wip: fix StandardEnvironment so that custom URLClassLoaders are actually used fix: fix StandardEnvironment so that custom URLClassLoaders are actually used Mar 6, 2021
@monperrus
Copy link
Collaborator

Thanks @andrewbwogi for the test case, we love test cases in Spoon.

Any idea why src/test/resources/classloader-test/spoon/Launcher.class is an empty file? And why it works this way?

@andrewbwogi
Copy link
Contributor Author

andrewbwogi commented Mar 6, 2021

This Launcher.class is not an entirely empty file, it is an empty class that has the same qualified name as the ordinary Spoon Launcher. In this test, if the default classloader is used, the ordinary Launcher will be loaded, and if the custom classloader is used, the empty Launcher will be loaded. It is empty so that the two Launchers can be distinguished.

@slarse
Copy link
Collaborator

slarse commented Mar 6, 2021

Just to clear up the confusion here, there seems to be a bug in the "Files changed" tab here on GitHub, which claims that Launcher.class is an empty file. If you actually view the file, it's 196 bytes, and I checked it just to be sure, it contains the following:

public class spoon.Launcher {
  public spoon.Launcher();
    Code:
       0: aload_0
       1: invokespecial #1                  // Method java/lang/Object."<init>":()V
       4: return
}

@andrewbwogi andrewbwogi changed the title fix: fix StandardEnvironment so that custom URLClassLoaders are actually used review: fix: StandardEnvironment so that custom URLClassLoaders are actually used Mar 8, 2021
@monperrus monperrus changed the title review: fix: StandardEnvironment so that custom URLClassLoaders are actually used fix: custom URLClassLoaders are now actually used Mar 9, 2021
@monperrus monperrus merged commit 7dc7b2c into INRIA:master Mar 9, 2021
@monperrus
Copy link
Collaborator

very nice fix @andrewbwogi

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.

Discussion : Prevent spoon from accessing the JVM class path
3 participants