MER-C/wiki-java

Upload from file fails on Java 17

MER-C opened this issue · 0 comments

MER-C commented

Uploads are broken on Java 17 but work on Java 11.

Non-chunked upload fails with no token.

jshell> test.upload(new File("webb_artists_conception.jpg"), "File:Test1234.jpg", "From https://www.nasa.gov/press-release/nasa-to-discuss-webb-s-arrival-at-final-destination-next-steps", "blah")
Jan 22, 2022 8:17:01 PM Wiki getPageInfo
INFO: Fetching URL https://test.wikipedia.org/w/api.php?&maxlag=5&prop=info&inprop=protection%7Cdisplaytitle%7Cwatchers&format=xml&action=query
Jan 22, 2022 8:17:02 PM Wiki getPageInfo
INFO: [test.wikipedia.org] Successfully retrieved page info for 1 pages.
Jan 22, 2022 8:17:02 PM Wiki getToken
INFO: Fetching URL https://test.wikipedia.org/w/api.php?&maxlag=5&meta=tokens&format=xml&action=query&type=csrf
Jan 22, 2022 8:17:02 PM Wiki upload
INFO: Fetching URL https://test.wikipedia.org/w/api.php?&maxlag=5&format=xml&action=upload
|  Exception java.lang.UnknownError: MW API error. Server response was: <?xml version="1.0"?><api servedby="mw1341"><error code="missingparam" info="The &quot;token&quot; parameter must be set." xml:space="preserve">See https://test.wikipedia.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at &amp;lt;https://lists.wikimedia.org/postorius/lists/mediawiki-api-announce.lists.wikimedia.org/&amp;gt; for notice of API deprecations and breaking changes.</error></api>
|        at Wiki.detectUncheckedErrors (Wiki.java:8380)
|        at Wiki.checkErrorsAndUpdateStatus (Wiki.java:8456)
|        at Wiki.upload (Wiki.java:4390)
|        at (#6:1)

Chunked upload hangs.

jshell> test.upload(new File("Richard-Wagner-Strasse_2_in_Bayreuth_(2).jpg"), "File:Test1235.jpg", "From https://commons.wikimedia.org/wiki/File:Richard-Wagner-Strasse_2_in_Bayreuth_(2).jpg", "blah")
Jan 22, 2022 8:15:05 PM Wiki getPageInfo
INFO: Fetching URL https://test.wikipedia.org/w/api.php?&maxlag=5&prop=info&inprop=protection%7Cdisplaytitle%7Cwatchers&format=xml&action=query
Jan 22, 2022 8:15:05 PM Wiki getPageInfo
INFO: [test.wikipedia.org] Successfully retrieved page info for 1 pages.
Jan 22, 2022 8:15:05 PM Wiki getToken
INFO: Fetching URL https://test.wikipedia.org/w/api.php?&maxlag=5&meta=tokens&format=xml&action=query&type=csrf
Jan 22, 2022 8:15:06 PM Wiki upload
INFO: Fetching URL https://test.wikipedia.org/w/api.php?&maxlag=5&format=xml&action=upload