With the latest version of HTMLParser some pages can not be processed, because a IllegalArgumentException (part of stacktrace below) is thrown. This is because the cookie is invalid. This is probably indeed the case, however, the complete parse process is aborted because of this exception. How can I avoid this? Or is this a bug? With version 1.5 this problem does not occure.
Regards,
Ramon
10:48:44,648 ERROR HtmlWebResourceParser:245 - java.lang.IllegalArgumentException: invalid cookie name: externe modules.ASPSESSIONIDCQRBCCRB - invalid cookie name: externe modules.ASPSESSIONIDCQRBCCRB
java.lang.IllegalArgumentException: invalid cookie name: externe modules.ASPSESSIONIDCQRBCCRB
at org.htmlparser.http.Cookie.<init>(Cookie.java:138)
at org.htmlparser.http.ConnectionManager.parseCookies(ConnectionManager.java:1069)
at org.htmlparser.http.ConnectionManager.openConnection(ConnectionManager.java:588)
at org.htmlparser.http.ConnectionManager.openConnection(ConnectionManager.java:767)
at org.htmlparser.Parser.<init>(Parser.java:304)
at org.htmlparser.Parser.<init>(Parser.java:316)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hmmm, I'm not sure it's a bug now.
Looking at the code, the isToken() check is complaining that the cookie can't contain any characters from the set:
"()<>@,;:\\\"/[]?={} \t"
...so spaces aren't allowed.
You could catch the exception and retry with cookie processing disabled.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've added code to handle bad cookie names.
It traps cookie name problems, but ignores any following cookies.
This will be available in the next build.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
With the latest version of HTMLParser some pages can not be processed, because a IllegalArgumentException (part of stacktrace below) is thrown. This is because the cookie is invalid. This is probably indeed the case, however, the complete parse process is aborted because of this exception. How can I avoid this? Or is this a bug? With version 1.5 this problem does not occure.
Regards,
Ramon
10:48:44,648 ERROR HtmlWebResourceParser:245 - java.lang.IllegalArgumentException: invalid cookie name: externe modules.ASPSESSIONIDCQRBCCRB - invalid cookie name: externe modules.ASPSESSIONIDCQRBCCRB
java.lang.IllegalArgumentException: invalid cookie name: externe modules.ASPSESSIONIDCQRBCCRB
at org.htmlparser.http.Cookie.<init>(Cookie.java:138)
at org.htmlparser.http.ConnectionManager.parseCookies(ConnectionManager.java:1069)
at org.htmlparser.http.ConnectionManager.openConnection(ConnectionManager.java:588)
at org.htmlparser.http.ConnectionManager.openConnection(ConnectionManager.java:767)
at org.htmlparser.Parser.<init>(Parser.java:304)
at org.htmlparser.Parser.<init>(Parser.java:316)
If it doesn't occur in version 1.5 it's probably a bug.
Can I report it in the bugtracker?
Ramon
Hmmm, I'm not sure it's a bug now.
Looking at the code, the isToken() check is complaining that the cookie can't contain any characters from the set:
"()<>@,;:\\\"/[]?={} \t"
...so spaces aren't allowed.
You could catch the exception and retry with cookie processing disabled.
I've added code to handle bad cookie names.
It traps cookie name problems, but ignores any following cookies.
This will be available in the next build.
Great! My opinion is that this is the right thing to do, you don't want to halt the parse process because of crappy cookies.
Ramon