question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NullPointerException in handleJavaScriptException

See original GitHub issue

I get the following NPE with HtmlUnit. I’m hoping the fix will be obvious to someone that knows the code well. If not I can try to come up with a way to reproduce it.

Thanks!

2020-02-17 15:29:15,504 ERROR [com.gargoylesoftware.htmlunit.javascript.background.JavaScriptJobManagerImpl] Job run failed with unexpected RuntimeException: null
java.lang.NullPointerException: null
	at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.handleJavaScriptException(JavaScriptEngine.java:984) ~[htmlunit-2.38.0-SNAPSHOT.jar:2.38.0-SNAPSHOT]
	at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:886) ~[htmlunit-2.38.0-SNAPSHOT.jar:2.38.0-SNAPSHOT]
	at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:624) ~[htmlunit-core-js-2.37.0.jar:?]
	at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:537) ~[htmlunit-core-js-2.37.0.jar:?]
	at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.callSecured(HtmlUnitContextFactory.java:354) ~[htmlunit-2.38.0-SNAPSHOT.jar:2.38.0-SNAPSHOT]
	at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:815) ~[htmlunit-2.38.0-SNAPSHOT.jar:2.38.0-SNAPSHOT]
	at com.gargoylesoftware.htmlunit.javascript.host.xml.XMLHttpRequest.setState(XMLHttpRequest.java:211) ~[htmlunit-2.38.0-SNAPSHOT.jar:2.38.0-SNAPSHOT]
	at com.gargoylesoftware.htmlunit.javascript.host.xml.XMLHttpRequest.doSend(XMLHttpRequest.java:785) ~[htmlunit-2.38.0-SNAPSHOT.jar:2.38.0-SNAPSHOT]
	at com.gargoylesoftware.htmlunit.javascript.host.xml.XMLHttpRequest.access$000(XMLHttpRequest.java:103) ~[htmlunit-2.38.0-SNAPSHOT.jar:2.38.0-SNAPSHOT]
	at com.gargoylesoftware.htmlunit.javascript.host.xml.XMLHttpRequest$1.run(XMLHttpRequest.java:634) ~[htmlunit-2.38.0-SNAPSHOT.jar:2.38.0-SNAPSHOT]
	at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:624) ~[htmlunit-core-js-2.37.0.jar:?]
	at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:537) ~[htmlunit-core-js-2.37.0.jar:?]
	at com.gargoylesoftware.htmlunit.javascript.background.JavascriptXMLHttpRequestJob.run(JavascriptXMLHttpRequestJob.java:36) ~[htmlunit-2.38.0-SNAPSHOT.jar:2.38.0-SNAPSHOT]
	at com.gargoylesoftware.htmlunit.javascript.background.JavaScriptJobManagerImpl.runSingleJob(JavaScriptJobManagerImpl.java:424) [htmlunit-2.38.0-SNAPSHOT.jar:2.38.0-SNAPSHOT]
	at com.gargoylesoftware.htmlunit.javascript.background.DefaultJavaScriptExecutor.run(DefaultJavaScriptExecutor.java:148) [htmlunit-2.38.0-SNAPSHOT.jar:2.38.0-SNAPSHOT]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_232]

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
rbricommented, Mar 22, 2020

Sorry for the delay, but… Think i have found the reason (and a solution) for your problem. Will make a new snapshot build later today (please check https://twitter.com/HtmlUnit for details).

Please try and inform about your results.

0reactions
rbricommented, Nov 11, 2021

i guess this is fixed

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Htmlunit-user] null pointer exception (in java-script)
Hello, I am using htmlunit for (small) data harvesting application. After pro-grammatically clicking one of the links, which opens
Read more >
HTMLUnit hangs/infinite loop on javascript exception
This is about HTMLUnit v2.24. On hitting this URL, The following exception is observed after which HTMLUnit does not proceed.
Read more >
'Re: [Htmlunit-user] How to restore javascript variables?' - MARC
NullPointerException.Some of the variables are functions and complex browser objects so I think we can't set them by using "variable_name=" + value.
Read more >
HtmlUnit / Bugs / #1589 java.lang.NullPointerException in ...
I am copying the junit test that recreates the problem. The stack trace: Exception in thread "main" net.sourceforge.htmlunit.corejs.javascript.
Read more >
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine
catch (final Exception e) { handleJavaScriptException(new ScriptException(htmlPage_, e, getSourceCode(cx)));
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found