From c02446c5a80820f32c4bb160491c452caa4d6175 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Tue, 25 Dec 2018 13:22:00 +0100 Subject: [PATCH] Relaxed position assertion (for overflows in large inline maps) Issue: SPR-17605 (cherry picked from commit b2756f5bd2075138ee03f64946bdc391f85b6647) --- .../springframework/expression/spel/ast/Assign.java | 10 +++++----- .../expression/spel/ast/SpelNodeImpl.java | 6 ++---- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/Assign.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/Assign.java index 4b0398760a..3289c66f5b 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/Assign.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/Assign.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,8 +21,8 @@ import org.springframework.expression.TypedValue; import org.springframework.expression.spel.ExpressionState; /** - * Represents assignment. An alternative to calling setValue() for an expression is to use - * an assign. + * Represents assignment. An alternative to calling {@code setValue} + * for an expression which indicates an assign statement. * *

Example: 'someNumberProperty=42' * @@ -31,8 +31,8 @@ import org.springframework.expression.spel.ExpressionState; */ public class Assign extends SpelNodeImpl { - public Assign(int pos,SpelNodeImpl... operands) { - super(pos,operands); + public Assign(int pos, SpelNodeImpl... operands) { + super(pos, operands); } diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/SpelNodeImpl.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/SpelNodeImpl.java index 47206f4190..f312b440f2 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/SpelNodeImpl.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/SpelNodeImpl.java @@ -66,12 +66,10 @@ public abstract class SpelNodeImpl implements SpelNode, Opcodes { public SpelNodeImpl(int pos, SpelNodeImpl... operands) { this.pos = pos; - // pos combines start and end so can never be zero because tokens cannot be zero length - Assert.isTrue(pos != 0, "Pos must not be 0"); if (!ObjectUtils.isEmpty(operands)) { this.children = operands; - for (SpelNodeImpl childNode : operands) { - childNode.parent = this; + for (SpelNodeImpl operand : operands) { + operand.parent = this; } } }