You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by or...@apache.org on 2023/10/05 14:42:16 UTC
[camel] branch main updated: (chores) camel-core: code cleanup
This is an automated email from the ASF dual-hosted git repository.
orpiske pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 3ef29185ab0 (chores) camel-core: code cleanup
3ef29185ab0 is described below
commit 3ef29185ab0c5d927f540a4698557533c89384b6
Author: Otavio Rodolfo Piske <an...@gmail.com>
AuthorDate: Thu Oct 5 15:27:48 2023 +0200
(chores) camel-core: code cleanup
Move the state index out of the loop to avoid confusing it with the loop conditions
---
.../src/main/java/org/apache/camel/impl/engine/AdviceIterator.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/AdviceIterator.java b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/AdviceIterator.java
index 1d59763bd0d..02461653431 100644
--- a/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/AdviceIterator.java
+++ b/core/camel-base-engine/src/main/java/org/apache/camel/impl/engine/AdviceIterator.java
@@ -28,11 +28,13 @@ final class AdviceIterator {
}
static void runAfterTasks(List<? extends CamelInternalProcessorAdvice> advices, Object[] states, Exchange exchange) {
- for (int i = advices.size() - 1, j = states.length - 1; i >= 0; i--) {
+ int stateIndex = states.length - 1;
+
+ for (int i = advices.size() - 1; i >= 0; i--) {
CamelInternalProcessorAdvice task = advices.get(i);
Object state = null;
if (task.hasState()) {
- state = states[j--];
+ state = states[stateIndex--];
}
try {
task.after(exchange, state);