Ignore:
Timestamp:
2015-12-22T18:51:39+01:00 (9 years ago)
Author:
simon04
Message:

JOSM/wikipedia: use Utils#encodeUrl

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/wikipedia/src/org/wikipedia/WikipediaApp.java

    r31848 r31849  
    8080                    + "?lang=" + wikipediaLang
    8181                    + "&depth=" + depth
    82                     + "&cat=" + encodeURL(category);
     82                    + "&cat=" + Utils.encodeUrl(category);
    8383            Main.info("Wikipedia: GET " + url);
    8484            try (final InputStream in = Utils.openURL(new URL(url));
     
    123123
    124124                try (final OutputStreamWriter out = new OutputStreamWriter(connection.getOutputStream(), "UTF-8")) {
    125                         out.write("articles=" + encodeURL(Utils.join(",", articleNames)));
     125                    out.write("articles=" + Utils.encodeUrl(Utils.join(",", articleNames)));
    126126                }
    127127
     
    304304                final String url = "https://tools.wmflabs.org/wiwosm/osmjson/getGeoJSON.php?action=check"
    305305                        + "&lang=" + wikipediaLang
    306                         + "&article=" + encodeURL(wikipediaArticle);
     306                        + "&article=" + Utils.encodeUrl(wikipediaArticle);
    307307                Main.info("Wikipedia: GET " + url);
    308308                try (final InputStream in = Utils.openURL(new URL(url));
     
    325325        public String getBrowserUrl() {
    326326            return "https://" + wikipediaLang + ".wikipedia.org/wiki/"
    327                     + encodeURL(wikipediaArticle.replace(" ", "_"));
     327                    + Utils.encodeUrl(wikipediaArticle.replace(" ", "_"));
    328328        }
    329329
     
    347347    }
    348348
    349     public static String encodeURL(String url) {
    350         try {
    351             return URLEncoder.encode(url, "UTF-8");
    352         } catch (UnsupportedEncodingException ex) {
    353             throw new IllegalStateException(ex);
    354         }
    355     }
    356 
    357349    public static <T> List<List<T>> partitionList(final List<T> list, final int size) {
    358350        return new AbstractList<List<T>>() {
Note: See TracChangeset for help on using the changeset viewer.