This is an automated email from the ASF dual-hosted git repository. tdsilva pushed a commit to branch 4.14-HBase-1.4 in repository https://gitbox.apache.org/repos/asf/phoenix.git
The following commit(s) were added to refs/heads/4.14-HBase-1.4 by this push: new 4abc497 PHOENIX-3413 Ineffective null check in LiteralExpression#newConstant() 4abc497 is described below commit 4abc497dddbb0cc6a50483136885247b47658348 Author: kliewkliew <kl...@apache.org> AuthorDate: Mon Feb 6 19:53:58 2017 -0800 PHOENIX-3413 Ineffective null check in LiteralExpression#newConstant() --- .../src/main/java/org/apache/phoenix/expression/LiteralExpression.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phoenix-core/src/main/java/org/apache/phoenix/expression/LiteralExpression.java b/phoenix-core/src/main/java/org/apache/phoenix/expression/LiteralExpression.java index f20d7e2..110177a 100644 --- a/phoenix-core/src/main/java/org/apache/phoenix/expression/LiteralExpression.java +++ b/phoenix-core/src/main/java/org/apache/phoenix/expression/LiteralExpression.java @@ -184,6 +184,7 @@ public class LiteralExpression extends BaseTerminalExpression { return getBooleanLiteralExpression((Boolean)value, determinism); } PDataType actualType = PDataType.fromLiteral(value); + type = type == null ? actualType : type; try { value = type.toObject(value, actualType); } catch (IllegalDataException e) { @@ -208,7 +209,7 @@ public class LiteralExpression extends BaseTerminalExpression { return getTypedNullLiteralExpression(type, determinism); } if (maxLength == null) { - maxLength = type == null || !type.isFixedWidth() ? null : type.getMaxLength(value); + maxLength = type.isFixedWidth() ? type.getMaxLength(value) : null; } return new LiteralExpression(value, type, b, maxLength, scale, sortOrder, determinism); }