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

fails to load Javascript files with Illegal character exception #101

Open
Deepashreehg opened this issue Nov 14, 2018 · 19 comments
Open

fails to load Javascript files with Illegal character exception #101

Deepashreehg opened this issue Nov 14, 2018 · 19 comments

Comments

@Deepashreehg
Copy link

Javascript files are not getting loaded. I'm getting below exception.

java.net.URISyntaxException: Illegal character in path at index 0: #138:9
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.(URI.java:588)
at com.programmaticallyspeaking.ncd.infra.ScriptURL$.create(ScriptURL.scala:67)
at com.programmaticallyspeaking.ncd.nashorn.JDIExtensions$RichLocation$.scriptURL$extension(JDIExtensions.scala:53)
at com.programmaticallyspeaking.ncd.nashorn.ScriptFactory.$anonfun$scriptUrlAndLocations$2(ScriptFactory.scala:62)
at scala.util.Success.$anonfun$map$1(Try.scala:251)
at scala.util.Success.map(Try.scala:209)
at com.programmaticallyspeaking.ncd.nashorn.ScriptFactory.scriptUrlAndLocations(ScriptFactory.scala:57)
at com.programmaticallyspeaking.ncd.nashorn.ScriptFactory.considerReferenceType(ScriptFactory.scala:39)
at com.programmaticallyspeaking.ncd.nashorn.ClassScanner.considerReferenceType(ClassScanner.scala:159)
at com.programmaticallyspeaking.ncd.nashorn.ClassScanner.scanOutstandingClasses(ClassScanner.scala:212)
at com.programmaticallyspeaking.ncd.nashorn.ClassScanner.$anonfun$scanOutstandingClasses$1(ClassScanner.scala:218)
at com.programmaticallyspeaking.ncd.nashorn.NashornDebuggerHost$$anon$2.$anonfun$onNext$1(NashornDebuggerHost.scala:180)
at com.programmaticallyspeaking.ncd.nashorn.NashornDebuggerHost$$anon$2.$anonfun$onNext$1$adapted(NashornDebuggerHost.scala:180)
at com.programmaticallyspeaking.ncd.nashorn.NashornDebugger.$anonfun$create$1(NashornDebugger.scala:58)
at scala.concurrent.Future$.$anonfun$apply$1(Future.scala:654)
at scala.util.Success.$anonfun$map$1(Try.scala:251)
at scala.util.Success.map(Try.scala:209)
at scala.concurrent.Future.$anonfun$map$1(Future.scala:288)
at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:29)
at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:29)
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:60)
at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)

I have added few logs statements in ScriptFactory.scala at line nos 44, 60, 61, 66.
I have attached the corresponding ncdbg.log file

ScriptFactory.scala.txt
ncdbg.log

@benoitcerrina
Copy link

Note that the exception is:

java.net.URISyntaxException: Illegal character in path at index 0: <eval>#138:9<eval>
	at java.net.URI$Parser.fail(URI.java:2848)

when the issue was written the "tags" were escaped by markdown

@provegard
Copy link
Owner

Thanks for the report, I'll take a look!

provegard added a commit that referenced this issue Nov 18, 2018
For example: <eval>#138!9<eval>

Handle this on the <eval> path, to ensure that ScriptURL doesn't
reject the URL as invalid.

Ref #101
@provegard
Copy link
Owner

I've added compensation for this. Could you please test the latest master? In particular, do the scripts show up in DevTools in a way that makes sense?

@benoitcerrina
Copy link

Hello,
we are testing, the fix seems to work. We have a problem to make sense of which script is what but it might be due to a change in the way our infrastructure is loading the scripts into Nashorn (which might also be why the problem came to the surface anyway). We need a bit more time to see if there is anything which you could do any better.

@provegard
Copy link
Owner

Ok, let me know what you find.

@provegard
Copy link
Owner

Any update?

@benoitcerrina
Copy link

yes. I still don't know what changed but we have a good bypass.
If we add
//# sourceURL=script name
to our scripts then the name is correctly picked up.

@benoitcerrina
Copy link

I haven't been able to successfully set breakpoints though:
I get the following error:
Setting an unresolved breakpoint with ID ndb1 at line 238 in script with URL xPlanDSLCCommandImplementation
or
Setting an unresolved breakpoint with ID ndb2 at line 109 in script with URL eval:///Script175

@provegard
Copy link
Owner

"Unresolved" means that the location isn't known yet, which typically happens when the function that contains the location hasn't yet been executed. But I suppose DevTools doesn't stop at the breakpoint? Does it show?

@benoitcerrina
Copy link

yes the breakpoints show and it doesn't stop.
Note that my colleague who opened this bug doesn't face this issue so I am not sure why it happens to me

@benoitcerrina
Copy link

One of the differences is that I am doing remote debugging (through an ssh tunnel) while the server she is using is on the machine running the debugger

@provegard
Copy link
Owner

Hm, could be some sort of timing problem. Can you post part of a log where you see the "Unresolved" messages and some context?

@benoitcerrina
Copy link

ncdbg.log
Hello,
I uploaded the log.
The breakpoint which should have been hit is the one set at 10:26:22.689 (note that in the log the name of the scrip is truncated, it should show up as xPlanDSLCCommandImplementation and shows correctly in chrome.
It should have happened between 10:26:39:199 and 10:26:39.465 (based on the server time which may be off by some milliseconds compare to the client but we can assume that it is correct in the seconds range

@benoitcerrina
Copy link

Not sure what else to give in term of context.

@provegard
Copy link
Owner

Huh, sounds like #100, where Chrome/DevTools cuts off the URL so what gets sent to ncdbg isn't the correct URL. Did you remove the v8only parameter?

@benoitcerrina
Copy link

let me check on that

@benoitcerrina
Copy link

looks like it, sorry for that, since it is not printed in the url any more, I am guessing I have let chrome autocomplete my url.
I did get some errors in the console but it stopped in the breakpoint.
I attached the new log
ncdbg.log
Thanks again for your help and responsiveness

@provegard
Copy link
Owner

No worries, I'm glad we sorted that out! I'll take a look at the log errors.

@provegard
Copy link
Owner

Do you see the error in any particular situation?

provegard added a commit that referenced this issue May 17, 2019
The idea is to get more information for the error mentioned
in #101
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