You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2009/05/08 09:45:55 UTC
svn commit: r772873 - in /camel/trunk/camel-core/src:
main/java/org/apache/camel/ main/java/org/apache/camel/impl/
main/java/org/apache/camel/processor/ test/java/org/apache/camel/
Author: davsclaus
Date: Fri May 8 07:45:55 2009
New Revision: 772873
URL: http://svn.apache.org/viewvc?rev=772873&view=rev
Log:
CAMEL-1591: Removed ExchangeProperty as it could cause unforseen sideeffect, see CAMEL-1590.
Removed:
camel/trunk/camel-core/src/main/java/org/apache/camel/ExchangeProperty.java
camel/trunk/camel-core/src/test/java/org/apache/camel/ExchangePropertyTest.java
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java
camel/trunk/camel-core/src/main/java/org/apache/camel/processor/AsyncProcessor.java
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java?rev=772873&r1=772872&r2=772873&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java Fri May 8 07:45:55 2009
@@ -24,9 +24,7 @@
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
-import org.apache.camel.ExchangeProperty;
import org.apache.camel.Message;
-import org.apache.camel.RuntimeCamelException;
import org.apache.camel.spi.UnitOfWork;
import org.apache.camel.util.ExchangeHelper;
import org.apache.camel.util.ObjectHelper;
@@ -145,46 +143,21 @@
public <T> T getProperty(String name, Class<T> type) {
Object value = getProperty(name);
-
- // if the property is also a well known property in ExchangeProperty then validate that the
- // value is of the same type
- ExchangeProperty<?> property = ExchangeProperty.getByName(name);
- if (property != null) {
- validateExchangePropertyIsExpectedType(property, type, value);
- }
-
return ExchangeHelper.convertToType(this, type, value);
}
- @SuppressWarnings("unchecked")
public void setProperty(String name, Object value) {
- ExchangeProperty<?> property = ExchangeProperty.getByName(name);
-
- // if the property is also a well known property in ExchangeProperty then validate that the
- // value is of the same type
- if (property != null) {
- Class type = value.getClass();
- validateExchangePropertyIsExpectedType(property, type, value);
- }
if (value != null) {
// avoid the NullPointException
getProperties().put(name, value);
} else {
- // if the value is null , we just remove the key from the map
+ // if the value is null, we just remove the key from the map
if (name != null) {
getProperties().remove(name);
}
}
}
- private <T> void validateExchangePropertyIsExpectedType(ExchangeProperty<?> property, Class<T> type, Object value) {
- if (value != null && property != null && !property.type().isAssignableFrom(type)) {
- throw new RuntimeCamelException("Type cast exception while getting an "
- + "Exchange Property value '" + value.toString() + "' on Exchange " + this
- + " for a well known Exchange Property with these traits: " + property);
- }
- }
-
public Object removeProperty(String name) {
return getProperties().remove(name);
}
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/AsyncProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/AsyncProcessor.java?rev=772873&r1=772872&r2=772873&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/AsyncProcessor.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/AsyncProcessor.java Fri May 8 07:45:55 2009
@@ -81,7 +81,7 @@
// wait for task to complete
Exchange response = future.get();
ExchangeHelper.copyResults(exchange, response);
- } if (wait == WaitForTaskToComplete.IfReplyExpected && ExchangeHelper.isOutCapable(exchange)) {
+ } else if (wait == WaitForTaskToComplete.IfReplyExpected && ExchangeHelper.isOutCapable(exchange)) {
// wait for task to complete as we expect a reply
Exchange response = future.get();
ExchangeHelper.copyResults(exchange, response);