camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/2] git commit: CAMEL-6723: Fixed Message history - Possible ArrayIndexOutOfBoundsException
Date Wed, 18 Sep 2013 11:41:24 GMT
Updated Branches:
  refs/heads/camel-2.12.x 3f9984b0c -> bb6b29175
  refs/heads/master 3eb7f8a04 -> e5f95f31c


CAMEL-6723: Fixed Message history - Possible ArrayIndexOutOfBoundsException


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e5f95f31
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e5f95f31
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e5f95f31

Branch: refs/heads/master
Commit: e5f95f31cb944c16dd65d2f475939c8752acc695
Parents: 3eb7f8a
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Wed Sep 18 13:09:11 2013 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Wed Sep 18 13:09:11 2013 +0200

----------------------------------------------------------------------
 .../src/main/java/org/apache/camel/impl/DefaultExchange.java | 8 +++++---
 .../src/main/java/org/apache/camel/util/ExchangeHelper.java  | 8 +++++---
 2 files changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/e5f95f31/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java
index 2c4a615..164ae67 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java
@@ -102,13 +102,15 @@ public final class DefaultExchange implements Exchange {
             return null;
         }
 
+        Map<String, Object> answer = new ConcurrentHashMap<String, Object>(properties);
+
         // safe copy message history using a defensive copy
-        List<MessageHistory> history = (List<MessageHistory>) properties.remove(Exchange.MESSAGE_HISTORY);
+        List<MessageHistory> history = (List<MessageHistory>) answer.remove(Exchange.MESSAGE_HISTORY);
         if (history != null) {
-            properties.put(Exchange.MESSAGE_HISTORY, new ArrayList<MessageHistory>(history));
+            answer.put(Exchange.MESSAGE_HISTORY, new ArrayList<MessageHistory>(history));
         }
 
-        return new ConcurrentHashMap<String, Object>(properties);
+        return answer;
     }
 
     public CamelContext getContext() {

http://git-wip-us.apache.org/repos/asf/camel/blob/e5f95f31/camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java b/camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java
index bc9943d..905ddda 100644
--- a/camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/util/ExchangeHelper.java
@@ -822,12 +822,14 @@ public final class ExchangeHelper {
             return null;
         }
 
+        Map<String, Object> answer = new ConcurrentHashMap<String, Object>(properties);
+
         // safe copy message history using a defensive copy
-        List<MessageHistory> history = (List<MessageHistory>) properties.remove(Exchange.MESSAGE_HISTORY);
+        List<MessageHistory> history = (List<MessageHistory>) answer.remove(Exchange.MESSAGE_HISTORY);
         if (history != null) {
-            properties.put(Exchange.MESSAGE_HISTORY, new ArrayList<MessageHistory>(history));
+            answer.put(Exchange.MESSAGE_HISTORY, new ArrayList<MessageHistory>(history));
         }
 
-        return new ConcurrentHashMap<String, Object>(properties);
+        return answer;
     }
 }


Mime
View raw message