Minor optimization

Replace usage of String#replace(String, String) with String#replace(char, char) 
where possible. The first uses Regex and is slower


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/7f8c6727
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/7f8c6727
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/7f8c6727

Branch: refs/heads/sandbox/component-queueing-2
Commit: 7f8c6727941d51aa8d3ff8a84d37ba5bf110df92
Parents: 6cceff4
Author: Martin Tzvetanov Grigorov <[email protected]>
Authored: Tue Feb 18 11:01:33 2014 +0200
Committer: Martin Tzvetanov Grigorov <[email protected]>
Committed: Tue Feb 18 11:01:33 2014 +0200

----------------------------------------------------------------------
 wicket-core/src/main/java/org/apache/wicket/Component.java         | 2 +-
 .../src/main/java/org/apache/wicket/util/cookies/CookieUtils.java  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/7f8c6727/wicket-core/src/main/java/org/apache/wicket/Component.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/main/java/org/apache/wicket/Component.java 
b/wicket-core/src/main/java/org/apache/wicket/Component.java
index cc31e88..a49596e 100644
--- a/wicket-core/src/main/java/org/apache/wicket/Component.java
+++ b/wicket-core/src/main/java/org/apache/wicket/Component.java
@@ -3919,7 +3919,7 @@ public abstract class Component
                {
                        String path = getPageRelativePath();
                        path = path.replace("_", "__");
-                       path = path.replace(":", "_");
+                       path = path.replace(':', '_');
                        tag.put("wicketpath", path);
                }
 

http://git-wip-us.apache.org/repos/asf/wicket/blob/7f8c6727/wicket-core/src/main/java/org/apache/wicket/util/cookies/CookieUtils.java
----------------------------------------------------------------------
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/util/cookies/CookieUtils.java 
b/wicket-core/src/main/java/org/apache/wicket/util/cookies/CookieUtils.java
index ad4b72f..401fe38 100644
--- a/wicket-core/src/main/java/org/apache/wicket/util/cookies/CookieUtils.java
+++ b/wicket-core/src/main/java/org/apache/wicket/util/cookies/CookieUtils.java
@@ -211,7 +211,7 @@ public class CookieUtils
                // cookie names cannot contain ':',
                // we replace ':' with '.' but first we have to encode '.' as 
'..'
                key = key.replace(".", "..");
-               key = key.replace(":", ".");
+               key = key.replace(':', '.');
                return key;
        }
 

Reply via email to