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

JarLauncher always use the same tmp directory #2951

Closed
lucacampanellaadn opened this issue Apr 26, 2019 · 3 comments
Closed

JarLauncher always use the same tmp directory #2951

lucacampanellaadn opened this issue Apr 26, 2019 · 3 comments
Assignees
Labels

Comments

@lucacampanellaadn
Copy link

The JarLauncher in the spoon decompiler always uses the same tmp directory, no matter if the jar changes. This result in having classes inside the model that were not actually inside the jar, just because the decompiled source code is still there from the previous Jar.

The line that gives the problem is line 92 in JarLauncher.java:
decompiledSrcPath = System.getProperty("java.io.tmpdir") + System.getProperty("file.separator") + "spoon-tmp";

I suggest to create a new random directory every time and delete it at the end, or just delete this one every time.
Thanks

@nharrand nharrand self-assigned this Apr 28, 2019
@nharrand nharrand added the bug label Apr 28, 2019
@nharrand
Copy link
Collaborator

nharrand commented Apr 28, 2019

It should already be deleted. (which means that if it isn't its a bug indeed!)

by lines 96-100

if (decompiledRoot.exists() && !decompiledRoot.canWrite()) {
	throw new SpoonException("Dir " + decompiledRoot.getPath() + " already exists and is not deletable.");
} else if (decompiledRoot.exists() && decompile) {
	decompiledRoot.delete();
}

Do you get a SpoonException? What permission does your temporary directory has?

@lucacampanellaadn
Copy link
Author

Hi! Thanks for the reply. Looking at the javadoc it says:
If this pathname denotes a directory, then the directory must be empty in order to be deleted.
I guess this is the problem, being the directory full with decompiled sources.
Thanks
Luca

@nharrand
Copy link
Collaborator

Ok my bad then. I'll fix this ASAP.

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

No branches or pull requests

2 participants