Changeset 466128c


Ignore:
Timestamp:
Oct 19, 2010 2:39:29 PM (10 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
ed399a07
Parents:
8c7a39f
Message:
  • replaceAll() → replace() when not using regex
  • ampersand escaping (lots more to do)
Location:
apps
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • apps/i2psnark/java/src/org/klomp/snark/web/I2PSnarkServlet.java

    r8c7a39f r466128c  
    12151215    private static String urlify(String s) {
    12161216        StringBuilder buf = new StringBuilder(256);
    1217         buf.append("<a href=\"").append(s).append("\">").append(s).append("</a>");
     1217        // browsers seem to work without doing this but let's be strict
     1218        String link = s.replace("&", "&amp;");
     1219        buf.append("<a href=\"").append(link).append("\">").append(link).append("</a>");
    12181220        return buf.toString();
    12191221    }
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/EditBean.java

    r8c7a39f r466128c  
    176176   
    177177    public String getAccessList(int tunnel) {
    178         return getProperty(tunnel, "i2cp.accessList", "").replaceAll(",", "\n");
     178        return getProperty(tunnel, "i2cp.accessList", "").replace(",", "\n");
    179179    }
    180180   
  • apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/IndexBean.java

    r8c7a39f r466128c  
    667667    public void setAccessList(String val) {
    668668        if (val != null)
    669             _otherOptions.put("i2cp.accessList", val.trim().replaceAll("\r\n", ",").replaceAll("\n", ",").replaceAll(" ", ","));
     669            _otherOptions.put("i2cp.accessList", val.trim().replace("\r\n", ",").replace("\n", ",").replace(" ", ","));
    670670    }
    671671    public void setCloseTime(String val) {
  • apps/routerconsole/java/src/net/i2p/router/web/ConfigUpdateHandler.java

    r8c7a39f r466128c  
    143143
    144144        if ( (_updateURL != null) && (_updateURL.length() > 0) ) {
    145             _updateURL = _updateURL.replaceAll("\r\n", ",").replaceAll("\n", ",");
     145            _updateURL = _updateURL.replace("\r\n", ",").replace("\n", ",");
    146146            String oldURL = _context.router().getConfigSetting(PROP_UPDATE_URL);
    147147            if ( (oldURL == null) || (!_updateURL.equals(oldURL)) ) {
     
    152152
    153153        if ( (_trustedKeys != null) && (_trustedKeys.length() > 0) ) {
    154             _trustedKeys = _trustedKeys.replaceAll("\r\n", ",").replaceAll("\n", ",");
     154            _trustedKeys = _trustedKeys.replace("\r\n", ",").replace("\n", ",");
    155155            String oldKeys = new TrustedUpdate(_context).getTrustedKeysString();
    156156            if ( (oldKeys == null) || (!_trustedKeys.equals(oldKeys)) ) {
  • apps/routerconsole/java/src/net/i2p/router/web/ConfigUpdateHelper.java

    r8c7a39f r466128c  
    4141        String url = _context.getProperty(ConfigUpdateHandler.PROP_UPDATE_URL);
    4242        if (url != null)
    43             return url.replaceAll(",", "\n");
     43            return url.replace(",", "\n");
    4444        else
    4545            return ConfigUpdateHandler.DEFAULT_UPDATE_URL;
  • apps/routerconsole/java/src/net/i2p/router/web/LogsHelper.java

    r8c7a39f r466128c  
    3434            return "";
    3535        else {
    36             str = str.replaceAll("<", "&lt;").replaceAll(">", "&gt;");
     36            str = str.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;");
    3737            return _("File location") + ": <b><code>" + f.getAbsolutePath() + "</code></b> <pre>" + str + "</pre>";
    3838        }
     
    5555        for (int i = msgs.size(); i > 0; i--) {
    5656            String msg = msgs.get(i - 1);
     57            msg = msg.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;");
    5758            buf.append("<li>");
    5859            if (colorize) {
     
    6162                // http://www.dhs.gov/xinfoshare/programs/Copy_of_press_release_0046.shtm
    6263                // but pink instead of yellow for WARN
     64                // FIXME doesnt work for translated levels
    6365                if (msg.contains("CRIT"))
    6466                    color = "#cc0000";
     
    7274                    color = "#006600";
    7375                buf.append("<font color=\"").append(color).append("\">");
    74                 buf.append(msg.replaceAll("<", "&lt;").replaceAll(">", "&gt;"));
     76                buf.append(msg);
    7577                buf.append("</font>");
    7678            } else {
Note: See TracChangeset for help on using the changeset viewer.