Changeset 6109 in josm for trunk/src/org


Ignore:
Timestamp:
2013-08-03T03:12:25+02:00 (11 years ago)
Author:
Don-vip
Message:

fix #8870 - Data layer context menu: Go to OSM wiki page does not always work

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java

    r6087 r6109  
    10761076                                } else {
    10771077                                    int osize = conn.getContentLength();
    1078                                     conn.disconnect();
    1079 
    1080                                     conn = Utils.openHttpConnection(new URI(u.toString()
    1081                                             .replace("=", "%3D") /* do not URLencode whole string! */
    1082                                             .replaceFirst("/wiki/", "/w/index.php?redirect=no&title=")
    1083                                             ).toURL());
    1084                                     conn.setConnectTimeout(Main.pref.getInteger("socket.timeout.connect",15)*1000);
     1078                                    if (osize > -1) {
     1079                                        conn.disconnect();
     1080   
     1081                                        conn = Utils.openHttpConnection(new URI(u.toString()
     1082                                                .replace("=", "%3D") /* do not URLencode whole string! */
     1083                                                .replaceFirst("/wiki/", "/w/index.php?redirect=no&title=")
     1084                                                ).toURL());
     1085                                        conn.setConnectTimeout(Main.pref.getInteger("socket.timeout.connect",15)*1000);
     1086                                    }
    10851087
    10861088                                    /* redirect pages have different content length, but retrieving a "nonredirect"
     
    10881090                                     *  content lengths, so we have to be fuzzy.. (this is UGLY, recode if u know better)
    10891091                                     */
    1090                                     if (Math.abs(conn.getContentLength() - osize) > 200) {
     1092                                    if (conn.getContentLength() != -1 && osize > -1 && Math.abs(conn.getContentLength() - osize) > 200) {
    10911093                                        Main.info("{0} is a mediawiki redirect", u);
    10921094                                        conn.disconnect();
Note: See TracChangeset for help on using the changeset viewer.