You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bv...@apache.org on 2012/11/11 15:14:32 UTC
svn commit: r1407997 - in /camel/branches/camel-2.10.x: ./
camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesResolver.java
Author: bvahdat
Date: Sun Nov 11 14:14:31 2012
New Revision: 1407997
URL: http://svn.apache.org/viewvc?rev=1407997&view=rev
Log:
Merged revisions 1407995 via svnmerge from
https://svn.apache.org/repos/asf/camel/trunk
........
r1407995 | bvahdat | 2012-11-11 15:11:25 +0100 (So, 11 Nov 2012) | 1 line
CAMEL-5784: Extracted the String-tailing-whitespace-trimming-logic into an extra method.
........
Modified:
camel/branches/camel-2.10.x/ (props changed)
camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesResolver.java
Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Merged /camel/trunk:r1407995
Propchange: camel/branches/camel-2.10.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesResolver.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesResolver.java?rev=1407997&r1=1407996&r2=1407997&view=diff
==============================================================================
--- camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesResolver.java (original)
+++ camel/branches/camel-2.10.x/camel-core/src/main/java/org/apache/camel/component/properties/DefaultPropertiesResolver.java Sun Nov 11 14:14:31 2012
@@ -131,25 +131,30 @@ public class DefaultPropertiesResolver i
for (Map.Entry<Object, Object> entry : properties.entrySet()) {
Object key = entry.getKey();
Object value = entry.getValue();
- // trim any trailing spaces which can be a problem when loading from
- // a properties file, note that java.util.Properties does already this
- // for any potential leading spaces so there's nothing to do there
if (value instanceof String) {
String s = (String) value;
- int endIndex = s.length();
- for (int index = s.length() - 1; index >= 0; index--) {
- if (s.charAt(index) == ' ') {
- endIndex = index;
- } else {
- break;
- }
- }
- s = s.substring(0, endIndex);
- value = s;
+
+ // trim any trailing spaces which can be a problem when loading from
+ // a properties file, note that java.util.Properties does already this
+ // for any potential leading spaces so there's nothing to do there
+ value = trimTrailingWhitespaces(s);
}
answer.put(key, value);
}
return answer;
}
+ private static String trimTrailingWhitespaces(String s) {
+ int endIndex = s.length();
+ for (int index = s.length() - 1; index >= 0; index--) {
+ if (s.charAt(index) == ' ') {
+ endIndex = index;
+ } else {
+ break;
+ }
+ }
+ String answer = s.substring(0, endIndex);
+ return answer;
+ }
+
}