Modify ↓
Opened 11 years ago
Closed 11 years ago
#8389 closed defect (fixed)
"Add names from Wikipedia" WP-API-calls 'titles'-attribute are malformed since not urlencoded
Reported by: | jjaf.de | Owned by: | simon04 |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Plugin wikipedia | Version: | latest |
Keywords: | WP-API urlencoded titles HTTP 400 Bad Request | Cc: |
Description
Problem
Most of the calls of "Add names from Wikipedia" give a plugin-error, since WP-API returns HTTP/1.0 400 Bad Request
for calls like:
GET /w/api.php?action=query&prop=langlinks&titles=St. John's, Antigua and Barbuda&lllimit=500&format=xml HTTP/1.1 User-Agent: Java/1.7.0_11 Host: en.wikipedia.org Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2 Connection: keep-alive
Cause
The problem is, that the wikipedia
-value wich ends up in titles
is not urlencoded.
Workaround
Workaround is to temporarily set an urlencoded wikipedia=en:St._John's%2C_Antigua_and_Barbuda
copied from the browser-location.
stackdump
Repository Root: http://josm.openstreetmap.de/svn Build-Date: 2012-11-29 02:31:07 Last Changed Author: stoecker Revision: 5608 Repository UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b URL: http://josm.openstreetmap.de/svn/trunk Last Changed Date: 2012-11-28 23:47:46 +0100 (Wed, 28 Nov 2012) Last Changed Rev: 5608 Identification: JOSM/1.5 (5608 de) Memory Usage: 177 MB / 247 MB (57 MB allocated, but free) Java version: 1.7.0_11, Oracle Corporation, Java HotSpot(TM) Client VM Operating system: Windows XP Dataset consistency test: No problems found Plugin: CommandLine (28807) Plugin: FixAddresses (28807) Plugin: PicLayer (28807) Plugin: ext_tools (28807) Plugin: jts (28945) Plugin: mirrored_download (28939) Plugin: namemanager (28807) Plugin: openstreetbugs (28807) Plugin: pdfimport (28807) Plugin: restart (29210) Plugin: reverter (28820) Plugin: tag2link (28807) Plugin: terracer (29037) Plugin: turnrestrictions (28807) Plugin: waydownloader (29210) Plugin: wikipedia (29068) java.lang.RuntimeException: java.io.IOException: Server returned HTTP response code: 400 for URL: http://en.wikipedia.org/w/api.php?action=query&prop=langlinks&titles=St. John's, Antigua and Barbuda&lllimit=500&format=xml at org.wikipedia.WikipediaApp.getInterwikiArticles(WikipediaApp.java:180) at org.wikipedia.WikipediaAddNamesAction.actionPerformed(WikipediaAddNamesAction.java:29) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.AbstractButton.doClick(Unknown Source) at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source) at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source) at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$200(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Caused by: java.io.IOException: Server returned HTTP response code: 400 for URL: http://en.wikipedia.org/w/api.php?action=query&prop=langlinks&titles=St. John's, Antigua and Barbuda&lllimit=500&format=xml at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at java.net.URL.openStream(Unknown Source) at org.wikipedia.WikipediaApp.getInterwikiArticles(WikipediaApp.java:171) ... 40 more
Attachments (0)
Note:
See TracTickets
for help on using tickets.
Fixed in [o29218], [o29219].