Wrap classpath entries which contains spaces in quotation marks #803
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I work on a project where we've run into problems with the classpath in FitNesse when some of the classpath entries contain spaces.
FitNesse will wrap the classpath in quotation marks when it contains a space, but in our case it fails to read the classpath correctly which cause the test run to fail. The information page after a test execution will display the complete classpath, but indicates that the problem occured at a space and that the rest of the classpath was cut off when it tried to run something. We experimented and found that if we didn't have any entries with spaces, it would run fine, however as soon as we added a jar located in a directory with spaces, it would fail.
We looked into how FitNesse constructs the classpath and found that the current behaviour in ClassPath seems to be that if any of the entries contains a space, the entire classpath is wrapped in quotes. (Additionally the path to the FitNesse-jar is prepended this quoted string in ClientBuilder.buildCommand given that it uses ClientBuilder.DEFAULT_COMMAND_PATTERN, but I don't know whether this affects things or not.) The resulting classpath is then used when running tests.
We did some experimenting by tweaking the classpath and hardcoding it into the test page instead of relying on java.class.path. We found that if we individually wrapped the entries containing spaces, we could run the tests again, so this seems to work better. The attached patch changes the wrapping a bit, from wrapping the whole classpath, to individually wrap those entries containing spaces.
Two comments regarding the patch:
Let me know if you have any questions or comments. :)
PS. This is seems to be the underlying cause of the issue I mentioned in #726, though it appears to have been unrelated.