Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Won't Fix
-
1.4.9
-
None
-
None
Description
./apache-wicket-1.4.9/src/wicket/src/main/java/org/apache/wicket/Component.java line: 1562 ./apache-wicket-1.4.9/src/wicket/src/main/java/org/apache/wicket/protocol/http/pagestore/DiskPageStore.java line: 410
more than 3 consecutive replace() is called to remove the special characters. It's 3+ times slower than using a for loop replace them all.
e.g. - str.replace('a', '#'); - str.replace('b', '%'); + StringBuilder sb = new StringBuilder( str.length() ); + for (int i=0; i < str.length(); i++) + { + char c = str.charAt(i); + if ( c == 'a' ) + sb.append('#'); + else if ( c== 'b' ) + sb.append('%'); + else + sb.append(c); + } + str = sb.toString();
This bug has the same problem as the MySQL bug : http://bugs.mysql.com/bug.php?id=45699