Ignore:
Timestamp:
2014-08-15T17:45:34+02:00 (10 years ago)
Author:
Don-vip
Message:

fix #10175 - ask for JOSM update in case of crash with old version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/WikiReader.java

    r7033 r7401  
    3636     * Read the page specified by the url and return the content.
    3737     *
    38      * If the url is within the baseurl path, parse it as an trac wikipage and replace relative
    39      * pathes etc..
     38     * If the url is within the baseurl path, parse it as an trac wikipage and replace relative paths etc..
     39     * @param url the URL to read
     40     * @return The page as string
    4041     *
    4142     * @throws IOException Throws, if the page could not be loaded.
     
    4445        URL u = new URL(url);
    4546        try (BufferedReader in = Utils.openURLReader(u)) {
    46             if (url.startsWith(baseurl) && !url.endsWith("?format=txt"))
     47            boolean txt = url.endsWith("?format=txt");
     48            if (url.startsWith(baseurl) && !txt)
    4749                return readFromTrac(in, u);
    48             return readNormal(in);
     50            return readNormal(in, !txt);
    4951        }
    5052    }
    5153
     54    /**
     55     * Reads the localized version of the given wiki page.
     56     * @param text The page title, without locale prefix
     57     * @return the localized version of the given wiki page
     58     * @throws IOException if any I/O error occurs
     59     */
    5260    public String readLang(String text) throws IOException {
    5361        String languageCode;
     
    8997    }
    9098
    91     private String readNormal(BufferedReader in) throws IOException {
     99    private String readNormal(BufferedReader in, boolean html) throws IOException {
    92100        StringBuilder b = new StringBuilder();
    93101        for (String line = in.readLine(); line != null; line = in.readLine()) {
     
    96104            }
    97105        }
    98         return "<html>" + b + "</html>";
     106        return html ? "<html>" + b + "</html>" : b.toString();
    99107    }
    100108
Note: See TracChangeset for help on using the changeset viewer.