Skip to content

Commit

Permalink
fix INRIA#4357: spoon doesn't handle paths containinig spaces correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
xzel23 committed Dec 16, 2021
1 parent dbb1841 commit 77103e7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/main/java/spoon/support/StandardEnvironment.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
import java.net.URLDecoder;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
Expand Down Expand Up @@ -418,7 +420,7 @@ public void setInputClassLoader(ClassLoader aClassLoader) {
if (onlyFileURLs) {
List<String> classpath = new ArrayList<>();
for (URL url : urls) {
classpath.add(url.getPath());
classpath.add(URLDecoder.decode(url.getPath(), StandardCharsets.UTF_8));
}
setSourceClasspath(classpath.toArray(new String[0]));
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
import java.lang.annotation.Retention;
import java.net.CookieManager;
import java.net.URLClassLoader;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.time.format.TextStyle;
import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -603,10 +605,11 @@ public void testPartialShadow() {
@Test
public void testInnerClassWithConstructorParameterAnnotated() {
Launcher launcher = new Launcher();
launcher.addInputResource(JavaReflectionTreeBuilderTest.class
launcher.addInputResource(URLDecoder.decode(JavaReflectionTreeBuilderTest.class
.getClassLoader()
.getResource("annotated-parameter-on-nested-class-constructor/Caller.java")
.getPath());
.getPath(),
StandardCharsets.UTF_8));
launcher.getEnvironment().setSourceClasspath(
new String[]{
"src/test/resources"
Expand Down

0 comments on commit 77103e7

Please sign in to comment.