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

[ES6] URISyntaxException if absolute path to input has a space #1219

Closed
jleyba opened this issue Oct 19, 2015 · 5 comments
Closed

[ES6] URISyntaxException if absolute path to input has a space #1219

jleyba opened this issue Oct 19, 2015 · 5 comments
Assignees

Comments

@jleyba
Copy link

jleyba commented Oct 19, 2015

This can be reproduced with empty files, you just need to use a directory that contains a space somewhere in the path.

$ java -jar compiler.jar --js=one.js --js="$(pwd)/two.js" --language_in=ECMASCRIPT6 --language_out=ECMASCRIPT5
java.lang.IllegalArgumentException: Illegal character in path at index 27: /Users/jleyba/Development/a b/two.js
    at java.net.URI.create(URI.java:852)
    at com.google.javascript.jscomp.ES6ModuleLoader.createUri(ES6ModuleLoader.java:140)
    at com.google.javascript.jscomp.ES6ModuleLoader.normalizeInputAddress(ES6ModuleLoader.java:119)
    at com.google.javascript.jscomp.ES6ModuleLoader.<init>(ES6ModuleLoader.java:67)
    at com.google.javascript.jscomp.Compiler.processEs6Modules(Compiler.java:1458)
    at com.google.javascript.jscomp.Compiler.parseInputs(Compiler.java:1294)
    at com.google.javascript.jscomp.Compiler.parse(Compiler.java:704)
    at com.google.javascript.jscomp.Compiler.compileInternal(Compiler.java:665)
    at com.google.javascript.jscomp.Compiler.access$000(Compiler.java:89)
    at com.google.javascript.jscomp.Compiler$2.call(Compiler.java:636)
    at com.google.javascript.jscomp.Compiler$2.call(Compiler.java:633)
    at com.google.javascript.jscomp.CompilerExecutor$2.call(CompilerExecutor.java:93)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.URISyntaxException: Illegal character in path at index 27: /Users/jleyba/Development/a b/two.js
    at java.net.URI$Parser.fail(URI.java:2848)
    at java.net.URI$Parser.checkChars(URI.java:3021)
    at java.net.URI$Parser.parseHierarchical(URI.java:3105)
    at java.net.URI$Parser.parse(URI.java:3063)
    at java.net.URI.<init>(URI.java:588)
    at java.net.URI.create(URI.java:850)
    ... 15 more
jleyba added a commit to SeleniumHQ/selenium that referenced this issue Oct 20, 2015
v20151015 crashes with the --language_in=ECMASCRIPT6 option when the input
file paths contain a space (as is apparently the case on the Selenium CI)

This has been reported in google/closure-compiler#1219

This reverts commit 2c04320.
@dimvar
Copy link
Contributor

dimvar commented Oct 21, 2015

Hey Martin, do you have time to take a look at this? Are module names allowed to have spaces? If so, how are spaces escaped in the module name? I looked at ES6ModuleLoader.java and backward slashes are replaced.
https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/ES6ModuleLoader.java#L139

The javadoc of the class mentions section 26.3.3.18.2 of the spec, but I couldn't find such a section here:
http://www.ecma-international.org/ecma-262/6.0/#sec-module-namespace-objects

@dimvar
Copy link
Contributor

dimvar commented Oct 21, 2015

If you can give me some pointers about what's the desired behavior, I can do the fix.

@jleyba
Copy link
Author

jleyba commented Oct 21, 2015

For the URI, could you just encode the space (%20)?

In toModuleName(URI), you could convert the %20 to a _

@dimvar dimvar closed this as completed in 904a204 Oct 22, 2015
@mprobst
Copy link
Contributor

mprobst commented Oct 22, 2015

Sorry, I've been traveling, only saw this now. The solutions LGTMs.

@dimvar
Copy link
Contributor

dimvar commented Oct 22, 2015

Np, the resolution turned out to be simple.

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

No branches or pull requests

3 participants