You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2012/08/28 15:39:13 UTC
svn commit: r1378131 -
/camel/trunk/camel-core/src/main/java/org/apache/camel/util/StringHelper.java
Author: davsclaus
Date: Tue Aug 28 13:39:12 2012
New Revision: 1378131
URL: http://svn.apache.org/viewvc?rev=1378131&view=rev
Log:
CAMEL-5396: Polished
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/util/StringHelper.java
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/util/StringHelper.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/StringHelper.java?rev=1378131&r1=1378130&r2=1378131&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/util/StringHelper.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/util/StringHelper.java Tue Aug 28 13:39:12 2012
@@ -185,9 +185,14 @@ public final class StringHelper {
throw new IllegalArgumentException("to cannot be null");
}
+ // fast check if there is any from at all
+ if (!input.contains(from)) {
+ return input;
+ }
+
final int len = from.length();
final int max = input.length();
- StringBuilder sb = new StringBuilder(input.length());
+ StringBuilder sb = new StringBuilder(max);
for (int i = 0; i < max;) {
if (i + len <= max) {
String token = input.substring(i, i + len);