From 985b02177efea5fbd798faa32e69a540cd0c130e Mon Sep 17 00:00:00 2001 From: James Date: Sat, 6 Oct 2018 17:17:13 +0800 Subject: [PATCH] jfinal enjoy 3.5 --- .../java/com/jfinal/template/expr/ast/Compare.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/jfinal/template/expr/ast/Compare.java b/src/main/java/com/jfinal/template/expr/ast/Compare.java index 09203ab..b92bda8 100644 --- a/src/main/java/com/jfinal/template/expr/ast/Compare.java +++ b/src/main/java/com/jfinal/template/expr/ast/Compare.java @@ -134,11 +134,12 @@ public class Compare extends Expr { } if (leftValue instanceof Comparable && + rightValue != null && leftValue.getClass() == rightValue.getClass()) { return ((Comparable)leftValue).compareTo((Comparable)rightValue) > 0; } - return checkType(leftValue, rightValue); + return checkComparisonValue(leftValue, rightValue); } @SuppressWarnings({"unchecked", "rawtypes"}) @@ -166,11 +167,12 @@ public class Compare extends Expr { } if (leftValue instanceof Comparable && + rightValue != null && leftValue.getClass() == rightValue.getClass()) { return ((Comparable)leftValue).compareTo((Comparable)rightValue) >= 0; } - return checkType(leftValue, rightValue); + return checkComparisonValue(leftValue, rightValue); } @SuppressWarnings({"unchecked", "rawtypes"}) @@ -198,11 +200,12 @@ public class Compare extends Expr { } if (leftValue instanceof Comparable && + rightValue != null && leftValue.getClass() == rightValue.getClass()) { return ((Comparable)leftValue).compareTo((Comparable)rightValue) < 0; } - return checkType(leftValue, rightValue); + return checkComparisonValue(leftValue, rightValue); } @SuppressWarnings({"unchecked", "rawtypes"}) @@ -230,11 +233,12 @@ public class Compare extends Expr { } if (leftValue instanceof Comparable && + rightValue != null && leftValue.getClass() == rightValue.getClass()) { return ((Comparable)leftValue).compareTo((Comparable)rightValue) <= 0; } - return checkType(leftValue, rightValue); + return checkComparisonValue(leftValue, rightValue); } private int getMaxType(Number obj1, Number obj2) { @@ -270,7 +274,7 @@ public class Compare extends Expr { return ret; } - private Boolean checkType(Object leftValue, Object rightValue) { + private Boolean checkComparisonValue(Object leftValue, Object rightValue) { if (leftValue == null) { throw new TemplateException("The operation target on the left side of \"" + op.value() + "\" can not be null", location); }