ncdbg icon indicating copy to clipboard operation
ncdbg copied to clipboard

fails to load Javascript files with Illegal character exception

Open Deepashreehg opened this issue 6 years ago • 19 comments

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

Deepashreehg avatar Nov 14 '18 09:11 Deepashreehg

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

benoitcerrina avatar Nov 14 '18 10:11 benoitcerrina

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

provegard avatar Nov 14 '18 10:11 provegard

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?

provegard avatar Nov 18 '18 20:11 provegard

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.

benoitcerrina avatar Nov 19 '18 09:11 benoitcerrina

Ok, let me know what you find.

provegard avatar Nov 19 '18 09:11 provegard

Any update?

provegard avatar Nov 21 '18 20:11 provegard

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 avatar Dec 06 '18 18:12 benoitcerrina

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

benoitcerrina avatar Dec 11 '18 20:12 benoitcerrina

"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?

provegard avatar Dec 11 '18 21:12 provegard

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 avatar Dec 12 '18 14:12 benoitcerrina

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

benoitcerrina avatar Dec 12 '18 14:12 benoitcerrina

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

provegard avatar Dec 12 '18 14:12 provegard

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 avatar Dec 12 '18 15:12 benoitcerrina

Not sure what else to give in term of context.

benoitcerrina avatar Dec 12 '18 15:12 benoitcerrina

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?

provegard avatar Dec 12 '18 15:12 provegard

let me check on that

benoitcerrina avatar Dec 12 '18 16:12 benoitcerrina

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

benoitcerrina avatar Dec 12 '18 16:12 benoitcerrina

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

provegard avatar Dec 12 '18 16:12 provegard

Do you see the error in any particular situation?

provegard avatar Dec 18 '18 22:12 provegard