You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by ch...@apache.org on 2024/09/20 09:16:54 UTC
(shardingsphere) branch master updated: Minor refactor in GeneratedKeyContextEngine to avoid IndexOutOfBoundException (#32936)
This is an automated email from the ASF dual-hosted git repository.
chengzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 474c0f3bb01 Minor refactor in GeneratedKeyContextEngine to avoid IndexOutOfBoundException (#32936)
474c0f3bb01 is described below
commit 474c0f3bb01db88368f98a037c4809534779f726
Author: Zhengqiang Duan <du...@apache.org>
AuthorDate: Fri Sep 20 17:16:48 2024 +0800
Minor refactor in GeneratedKeyContextEngine to avoid IndexOutOfBoundException (#32936)
* Minor refactor in GeneratedKeyContextEngine to avoid IndexOutOfBoundException
* fix unit test
---
.../segment/insert/keygen/engine/GeneratedKeyContextEngine.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/context/segment/insert/keygen/engine/GeneratedKeyContextEngine.java b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/context/segment/insert/keygen/engine/GeneratedKeyContextEngine.java
index 5f71f14f766..0bb6f85e5de 100644
--- a/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/context/segment/insert/keygen/engine/GeneratedKeyContextEngine.java
+++ b/infra/binder/src/main/java/org/apache/shardingsphere/infra/binder/context/segment/insert/keygen/engine/GeneratedKeyContextEngine.java
@@ -98,7 +98,8 @@ public final class GeneratedKeyContextEngine {
if (params.isEmpty()) {
continue;
}
- if (null != params.get(((ParameterMarkerExpressionSegment) expression).getParameterMarkerIndex())) {
+ if (params.size() > ((ParameterMarkerExpressionSegment) expression).getParameterMarkerIndex()
+ && null != params.get(((ParameterMarkerExpressionSegment) expression).getParameterMarkerIndex())) {
result.getGeneratedValues().add((Comparable<?>) params.get(((ParameterMarkerExpressionSegment) expression).getParameterMarkerIndex()));
}
} else if (expression instanceof LiteralExpressionSegment) {