Changeset 1480 in josm


Ignore:
Timestamp:
2009-03-10T17:07:46+01:00 (15 years ago)
Author:
stoecker
Message:

added user agent

Location:
trunk/src/org/openstreetmap/josm
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/AboutAction.java

    r1326 r1480  
    1717import java.util.regex.Matcher;
    1818import java.util.regex.Pattern;
     19import java.util.Properties;
    1920
    2021import javax.swing.BorderFactory;
     
    8485    static public String getTextBlock() {
    8586        return revision.getText();
     87    }
     88
     89    static public void setUserAgent() {
     90        Properties sysProp = System.getProperties();
     91        sysProp.put("http.agent", "JOSM/1.5 ("+version+")");
     92        System.setProperties(sysProp);
    8693    }
    8794
  • trunk/src/org/openstreetmap/josm/data/Preferences.java

    r1473 r1480  
    522522
    523523    private void setSystemProperties() {
    524         Properties sysProp = System.getProperties();
    525524        if (getBoolean(ProxyPreferences.PROXY_ENABLE)) {
     525            Properties sysProp = System.getProperties();
    526526            sysProp.put("proxySet", "true");
    527527            sysProp.put("http.proxyHost", get(ProxyPreferences.PROXY_HOST));
     
    531531                sysProp.put("proxyPassword", get(ProxyPreferences.PROXY_PASS));
    532532            }
    533         }/* else {
    534             sysProp.put("proxySet", "false");
    535             sysProp.remove("http.proxyHost");
    536             sysProp.remove("proxyPort");
    537             sysProp.remove("proxyUser");
    538             sysProp.remove("proxyPassword");
    539         }*/
    540         System.setProperties(sysProp);
     533            System.setProperties(sysProp);
     534        }
     535        AboutAction.setUserAgent();
    541536    }
    542537}
  • trunk/src/org/openstreetmap/josm/gui/GettingStarted.java

    r1450 r1480  
    274274                curVersion, latest, myVersion)
    275275                + "</div>";
    276             } catch(Exception e) {e.printStackTrace();}
     276            } catch(Exception e) {
     277              // e.printStackTrace();
     278            }
    277279
    278280            return "";
  • trunk/src/org/openstreetmap/josm/tools/WikiReader.java

    r1475 r1480  
    1414public class WikiReader {
    1515
    16     public static final String JOSM_EXTERN = "http://josm-extern.";
    1716    private final String baseurl;
    1817
     
    3837
    3938    private String readNormal(BufferedReader in) throws IOException {
    40         String b = "<html>";
     39        String b = "";
    4140        for (String line = in.readLine(); line != null; line = in.readLine()) {
    42             line = adjustText(line);
    4341            if(!line.contains("[[TranslatedPages]]"))
    44               b += line + "\n";
     42                b += line.replaceAll(" />", ">") + "\n";
    4543        }
    46         return b;
     44        return "<html>" + b + "</html>";
    4745    }
    4846
    4947    private String readFromTrac(BufferedReader in, String url) throws IOException {
    5048        boolean inside = false;
    51         StringBuilder b = new StringBuilder("<html>");
     49        String b = "";
    5250        for (String line = in.readLine(); line != null; line = in.readLine()) {
    5351            if (line.contains("<div id=\"searchable\">"))
     
    5856                inside = false;
    5957            if (inside) {
    60                 line = line.replaceAll("<img src=\"/", "<img src=\""+baseurl+"/");
    61                 line = line.replaceAll("href=\"/", "href=\""+baseurl+"/");
    62                 if (!line.contains("$"))
    63                     line = line.replaceAll("<p>Describe \"([^\"]+)\" here</p>", "<p>Describe \"$1\" <a href=\""+JOSM_EXTERN+url.substring(7)+"\">here</a></p>");
    64                 line = adjustText(line);
    65                 b.append(line);
    66                 b.append("\n");
     58                b += line.replaceAll("<img src=\"/", "<img src=\""+baseurl+"/")
     59                         .replaceAll("href=\"/", "href=\""+baseurl+"/")
     60                         .replaceAll(" />", ">") + "\n";
    6761            }
    6862        }
    69         b.append("</html>");
    70         return b.toString();
    71     }
    72 
    73     private String adjustText(String text) {
    74         text = text.replaceAll(" />", ">");
    75         return text;
     63        return "<html>" + b + "</html>";
    7664    }
    7765}
Note: See TracChangeset for help on using the changeset viewer.