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

[Bug] StandardEnvironment does not work if path contains spaces #4357

Closed
xzel23 opened this issue Dec 16, 2021 · 4 comments · Fixed by #4358
Closed

[Bug] StandardEnvironment does not work if path contains spaces #4357

xzel23 opened this issue Dec 16, 2021 · 4 comments · Fixed by #4358

Comments

@xzel23
Copy link
Contributor

xzel23 commented Dec 16, 2021

Describe the bug
StandardEnvironment does not work if classpath contains spaces.

To Reproduce

check out spoon from git to a location where the path contains a space character and run mvn compile test. test will fail in:

  • JDTImportBuilderTest because of an issue in StandardEnvironment
  • JavaReflectionTreeBBuilderTest because of incorrectly converting URL to String

I think, the correct fix would be to refactor all methods taking a String argument for a path or filename should be refactored to use Path, in a first step by introducing a Path overload and deprecating the String versions.

Input: N/A

Processing with Spoon: N/A

Output: N/A

Operating system, JDK and Spoon version used

  • OS: MacOS Monterey (12.1)
  • JDK: GraalVM CE (JDK 17.0.1)
  • Spoon version: current github (2021-12-16)
@xzel23
Copy link
Contributor Author

xzel23 commented Dec 16, 2021

I submitted a PR for this, please review and comment.

@algomaster99
Copy link
Contributor

Hi @xzel23 !

Could you please elaborate what you mean by "check out spoon from git to a location where the path contains a space character and run mvn compile test"? Maven commands can be run only in paths where a pom.xml is also present so I am unable to reproduce this issue.

spoon/directory with spaces$ mvn compile test
The goal you specified requires a project to execute but there is no POM in this directory

@xzel23
Copy link
Contributor Author

xzel23 commented Dec 16, 2021

Yes, of course:

mkdir "folder with spaces"
cd "folder with spaces"
git clone https://github.com/INRIA/spoon.git
cd spoon
mvn compile test

@xzel23
Copy link
Contributor Author

xzel23 commented Dec 29, 2021

IMHO #4358 is ready for merging so that this can be closed after the PR is applied.

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 a pull request may close this issue.

2 participants