You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by al...@apache.org on 2014/06/26 12:39:41 UTC
[04/11] git commit: trim strings before coercing to numbers
trim strings before coercing to numbers
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/0f3d6ea6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/0f3d6ea6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/0f3d6ea6
Branch: refs/heads/master
Commit: 0f3d6ea61b1aba59a95768993ba7abc0663c90f1
Parents: 2c8410c
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Mon Jun 2 23:00:30 2014 +0100
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Tue Jun 24 21:59:14 2014 +0100
----------------------------------------------------------------------
core/src/main/java/brooklyn/util/flags/TypeCoercions.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/0f3d6ea6/core/src/main/java/brooklyn/util/flags/TypeCoercions.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/util/flags/TypeCoercions.java b/core/src/main/java/brooklyn/util/flags/TypeCoercions.java
index 93fe775..4ce94bc 100644
--- a/core/src/main/java/brooklyn/util/flags/TypeCoercions.java
+++ b/core/src/main/java/brooklyn/util/flags/TypeCoercions.java
@@ -515,7 +515,7 @@ public class TypeCoercions {
});
registerAdapter(String.class, AtomicLong.class, new Function<String,AtomicLong>() {
@Override public AtomicLong apply(final String input) {
- return new AtomicLong(Long.parseLong(input));
+ return new AtomicLong(Long.parseLong(input.trim()));
}
});
registerAdapter(Integer.class, AtomicInteger.class, new Function<Integer,AtomicInteger>() {
@@ -525,7 +525,7 @@ public class TypeCoercions {
});
registerAdapter(String.class, AtomicInteger.class, new Function<String,AtomicInteger>() {
@Override public AtomicInteger apply(final String input) {
- return new AtomicInteger(Integer.parseInt(input));
+ return new AtomicInteger(Integer.parseInt(input.trim()));
}
});
/** This always returns a {@link Double}, cast as a {@link Number};