0

I've problem with a cookies in WebEngine in Java. When I try open the specified url, I receive that exception:

lip 13, 2017 3:18:25 PM com.sun.webkit.network.URLLoader doRun
    WARNING: Unexpected error
    java.lang.IllegalArgumentException: Invalid cookie name-value pair
        at java.net.HttpCookie.parseInternal(HttpCookie.java:823)
        at java.net.HttpCookie.parse(HttpCookie.java:202)
        at java.net.HttpCookie.access$100(HttpCookie.java:58)
        at java.net.HttpCookie$12.parse(HttpCookie.java:977)
        at sun.net.www.protocol.http.HttpURLConnection.filterHeaderField(HttpURLConnection.java:2927)
        at sun.net.www.protocol.http.HttpURLConnection.getFilteredHeaderFields(HttpURLConnection.java:2964)
        at sun.net.www.protocol.http.HttpURLConnection.getHeaderFields(HttpURLConnection.java:3008)
        at sun.net.www.protocol.https.HttpsURLConnectionImpl.getHeaderFields(HttpsURLConnectionImpl.java:283)
        at com.sun.webkit.network.URLLoader.extractHeaders(URLLoader.java:988)
        at com.sun.webkit.network.URLLoader.didReceiveResponse(URLLoader.java:765)
        at com.sun.webkit.network.URLLoader.receiveResponse(URLLoader.java:497)
        at com.sun.webkit.network.URLLoader.doRun(URLLoader.java:164)
        at com.sun.webkit.network.URLLoader.lambda$run$98(URLLoader.java:129)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.webkit.network.URLLoader.run(URLLoader.java:128)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        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:748)

It causes error on the webpage. I need to open this URL. In the Firefox or Chrome everything is right. How to fix it?

DarekEs
  • 1
  • 2

1 Answers1

0

I got the same error on loading the custom HTML page in JavaFX WebView

Dec 03, 2017 8:37:26 PM com.sun.webkit.network.URLLoader doRun WARNING: Unexpected error java.lang.IllegalArgumentException: cookie version should be 0 or 1

This solved the issue for me.

java.net.CookieHandler.setDefault(null);

Hope this helps you aswell.

koiralo
  • 22,594
  • 6
  • 51
  • 72