activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r530545 - /activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java
Date Thu, 19 Apr 2007 21:00:41 GMT
Author: chirino
Date: Thu Apr 19 14:00:40 2007
New Revision: 530545

URL: http://svn.apache.org/viewvc?view=rev&rev=530545
Log:
Fixed bug reported at: http://www.nabble.com/-camel--Splitter-problem-tf3609288s2354.html#a10085314


Modified:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java?view=diff&rev=530545&r1=530544&r2=530545
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java
Thu Apr 19 14:00:40 2007
@@ -53,14 +53,26 @@
     }
 
     public void copyFrom(Exchange exchange) {
-        setHeaders(new HashMap<String, Object>(exchange.getProperties()));
-        setIn(exchange.getIn().copy());
-        setOut(exchange.getOut().copy());
-        setFault(exchange.getFault().copy());
+        setHeaders(safeCopy(exchange.getProperties()));
+        setIn(safeCopy(exchange.getIn()));
+        setOut(safeCopy(exchange.getOut()));
+       	setFault(safeCopy(exchange.getFault()));        
         setException(exchange.getException());
     }
 
-    public Exchange newInstance() {
+    static private Map<String, Object> safeCopy(Map<String, Object> properties)
{
+		if(properties == null)
+			return null;
+		return new HashMap<String, Object>(properties);
+	}
+
+	static private Message safeCopy(Message message) {
+    	if( message == null)
+    		return null;
+    	return message.copy();
+	}
+
+	public Exchange newInstance() {
         return new DefaultExchange(context);
     }
 



Mime
View raw message