User talk:Gracenotes/Java code

Problems
I've tried this bot on Wikibooks, and I've got two problems: JackPotte (talk) 21:44, 12 February 2012 (UTC)
 * 1) Impossible to login, whereas it works with the same user and password in my Python scripts.
 * 2) When I comment the two return; supposed to block the editions when not logged, I've got this:
 * 1
 * The following code seems to contains the bug:


 * The getHeaderFieldKey is called twice and first called with i == 1 (because ++ before).
 * Also the last line delete the first two characters even if the string is empty (-> exception will be thrown).
 * Try this instead:


 * 2
 * Also try to explicitly specify the request method POST in userLogin method:


 * 3
 * Calling the connect method is useless (I don't use it in my Java code, which seems to work properly) :


 * 4
 * Before getting response header the request should be sent, by getting the HTTP response:


 * 5
 * The lgtoken is missing (See mw:API:Login). It should be a random string, or the one returned by the server when none is provided in the NeedToken response (to copy in a 2nd login request).


 * Otherwise, see also https://web.archive.org/web/20131208024735/http://wiki-java.googlecode.com/svn/trunk/src/org/wikipedia/Wiki.java
 * -- ◄ David L • discuter ► 09:15, 13 February 2012 (UTC)
 * -- ◄ David L • discuter ► 09:15, 13 February 2012 (UTC)