Changeset 11044 in josm for trunk/src


Ignore:
Timestamp:
2016-09-23T21:09:16+02:00 (8 years ago)
Author:
simon04
Message:

fix #13687 - Use CachedFile class for /data/help-browser.css in HelpBrowser class (patch by sebastic, modified)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/help/HelpBrowser.java

    r10791 r11044  
    1414import java.awt.event.WindowAdapter;
    1515import java.awt.event.WindowEvent;
    16 import java.io.BufferedReader;
    1716import java.io.IOException;
    18 import java.io.InputStreamReader;
    1917import java.io.StringReader;
    2018import java.nio.charset.StandardCharsets;
     
    5048import org.openstreetmap.josm.gui.widgets.JosmEditorPane;
    5149import org.openstreetmap.josm.gui.widgets.JosmHTMLEditorKit;
     50import org.openstreetmap.josm.io.CachedFile;
    5251import org.openstreetmap.josm.tools.ImageProvider;
    5352import org.openstreetmap.josm.tools.InputMapUtils;
     
    139138    protected StyleSheet buildStyleSheet() {
    140139        StyleSheet ss = new StyleSheet();
    141         StringBuilder css = new StringBuilder();
    142         try (BufferedReader breader = new BufferedReader(
    143                 new InputStreamReader(
    144                         getClass().getResourceAsStream("/data/help-browser.css"), StandardCharsets.UTF_8
    145                 )
    146         )) {
    147             String line;
    148             while ((line = breader.readLine()) != null) {
    149                 css.append(line);
    150                 css.append('\n');
    151             }
     140        final String css;
     141        try (CachedFile cf = new CachedFile("resource://data/help-browser.css")) {
     142            css = new String(cf.getByteContent(), StandardCharsets.ISO_8859_1);
    152143        } catch (IOException e) {
    153144            Main.error(tr("Failed to read CSS file ''help-browser.css''. Exception is: {0}", e.toString()));
     
    155146            return ss;
    156147        }
    157         ss.addRule(css.toString());
     148        ss.addRule(css);
    158149        return ss;
    159150    }
Note: See TracChangeset for help on using the changeset viewer.