You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 10:11:18 UTC
[sling-org-apache-sling-scripting-sightly-compiler-java] 27/31:
SLING-6633 - [HTL] NumberFormat should support String-properties with
number value
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.sightly.compiler.java-1.0.10
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-sightly-compiler-java.git
commit 7025655c38f7a4b1a7c7a261e62434662bc06114
Author: Radu Cotescu <ra...@apache.org>
AuthorDate: Mon Mar 13 13:45:20 2017 +0000
SLING-6633 - [HTL] NumberFormat should support String-properties with number value
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/scripting/sightly/java-compiler@1786688 13f79535-47bb-0310-9956-ffa450edef68
---
.../scripting/sightly/render/AbstractRuntimeObjectModel.java | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/main/java/org/apache/sling/scripting/sightly/render/AbstractRuntimeObjectModel.java b/src/main/java/org/apache/sling/scripting/sightly/render/AbstractRuntimeObjectModel.java
index aae53e4..514ca48 100644
--- a/src/main/java/org/apache/sling/scripting/sightly/render/AbstractRuntimeObjectModel.java
+++ b/src/main/java/org/apache/sling/scripting/sightly/render/AbstractRuntimeObjectModel.java
@@ -79,6 +79,9 @@ public abstract class AbstractRuntimeObjectModel implements RuntimeObjectModel {
if (target == null) {
return false;
}
+ if (target instanceof Number) {
+ return true;
+ }
String value = toString(target);
return NumberUtils.isNumber(value);
}
@@ -107,6 +110,12 @@ public abstract class AbstractRuntimeObjectModel implements RuntimeObjectModel {
@Override
public Number toNumber(Object object) {
+ if (object == null) {
+ return null;
+ }
+ if (object instanceof Number) {
+ return (Number) object;
+ }
String stringValue = toString(object);
try {
return NumberUtils.createNumber(stringValue);
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.