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 2010/04/02 10:21:55 UTC
svn commit: r930181 -
/camel/trunk/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesParser.java
Author: davsclaus
Date: Fri Apr 2 08:21:55 2010
New Revision: 930181
URL: http://svn.apache.org/viewvc?rev=930181&view=rev
Log:
CAMEL-2599: Preparing for changing tokens for Camel properties comp due clash with Spring EL in Spring 3.0
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesParser.java
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesParser.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesParser.java?rev=930181&r1=930180&r2=930181&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesParser.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/properties/PropertiesParser.java Fri Apr 2 08:21:55 2010
@@ -27,6 +27,9 @@ import java.util.Properties;
*/
public final class PropertiesParser {
+ private static final String PREFIX_TOKEN = "#{";
+ private static final String SUFFIX_TOKEN = "}";
+
private PropertiesParser() {
}
@@ -59,7 +62,7 @@ public final class PropertiesParser {
visited.addAll(replaced);
// are we done yet
- done = !answer.contains("#{");
+ done = !answer.contains(PREFIX_TOKEN);
}
return answer;
}
@@ -70,7 +73,7 @@ public final class PropertiesParser {
int pivot = 0;
int size = uri.length();
while (pivot < size) {
- int idx = uri.indexOf("#{", pivot);
+ int idx = uri.indexOf(PREFIX_TOKEN, pivot);
if (idx < 0) {
sb.append(createConstantPart(uri, pivot, size));
break;
@@ -78,10 +81,10 @@ public final class PropertiesParser {
if (pivot < idx) {
sb.append(createConstantPart(uri, pivot, idx));
}
- pivot = idx + 2;
- int endIdx = uri.indexOf('}', pivot);
+ pivot = idx + PREFIX_TOKEN.length();
+ int endIdx = uri.indexOf(SUFFIX_TOKEN, pivot);
if (endIdx < 0) {
- throw new IllegalArgumentException("Expecting } but found end of string for uri: " + uri);
+ throw new IllegalArgumentException("Expecting " + SUFFIX_TOKEN + " but found end of string for uri: " + uri);
}
String key = uri.substring(pivot, endIdx);
@@ -90,7 +93,7 @@ public final class PropertiesParser {
throw new IllegalArgumentException("Property with key [" + key + "] not found in properties for uri: " + uri);
}
sb.append(part);
- pivot = endIdx + 1;
+ pivot = endIdx + SUFFIX_TOKEN.length();
}
}
return sb.toString();