camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r749954 - /camel/trunk/camel-core/src/main/java/org/apache/camel/model/language/ExpressionType.java
Date Wed, 04 Mar 2009 10:02:07 GMT
Author: davsclaus
Date: Wed Mar  4 10:02:06 2009
New Revision: 749954

URL: http://svn.apache.org/viewvc?rev=749954&view=rev
Log:
Fixed a bug in expression type for predicates, eg when using: when().header("foo") it would
cause a NPE, but using when(header("foo").isNotNull()) works.

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/model/language/ExpressionType.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/language/ExpressionType.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/language/ExpressionType.java?rev=749954&r1=749953&r2=749954&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/language/ExpressionType.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/language/ExpressionType.java
Wed Mar  4 10:02:06 2009
@@ -34,6 +34,7 @@
 import org.apache.camel.Expression;
 import org.apache.camel.Predicate;
 import org.apache.camel.builder.ExpressionClause;
+import org.apache.camel.builder.PredicateBuilder;
 import org.apache.camel.impl.DefaultRouteContext;
 import org.apache.camel.spi.Language;
 import org.apache.camel.spi.RouteContext;
@@ -148,7 +149,10 @@
         if (predicate == null) {
             if (expressionType != null) {
                 predicate = expressionType.createPredicate(routeContext);
-            } else {
+            } else if (expressionValue != null) {
+                predicate = PredicateBuilder.toPredicate(expressionValue);
+            } else if (getExpression() != null) {
+                ObjectHelper.notNull("language", getLanguage());
                 CamelContext camelContext = routeContext.getCamelContext();
                 Language language = camelContext.resolveLanguage(getLanguage());
                 predicate = language.createPredicate(getExpression());
@@ -162,7 +166,8 @@
         if (expressionValue == null) {
             if (expressionType != null) {
                 expressionValue = expressionType.createExpression(routeContext);
-            } else {
+            } else if (getExpression() != null){
+                ObjectHelper.notNull("language", getLanguage());
                 CamelContext camelContext = routeContext.getCamelContext();
                 Language language = camelContext.resolveLanguage(getLanguage());
                 expressionValue = language.createExpression(getExpression());



Mime
View raw message