You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by dk...@apache.org on 2011/09/19 23:11:23 UTC

svn commit: r1172823 - in /camel/branches/camel-2.8.x: ./ camel-core/src/main/java/org/apache/camel/ camel-core/src/main/java/org/apache/camel/model/ components/camel-spring/src/test/java/org/apache/camel/spring/processor/

Author: dkulp
Date: Mon Sep 19 21:11:22 2011
New Revision: 1172823

URL: http://svn.apache.org/viewvc?rev=1172823&view=rev
Log:
Merged revisions 1159528 via svnmerge from 
https://svn.apache.org/repos/asf/camel/trunk

........
  r1159528 | davsclaus | 2011-08-19 03:52:45 -0400 (Fri, 19 Aug 2011) | 1 line
  
  CAMEL-4353: Improved error message if using transacted in the DSL and TX manager could not be found. Now we fail fast with detailed exception.
........

Added:
    camel/branches/camel-2.8.x/components/camel-spring/src/test/java/org/apache/camel/spring/processor/JavaDslTransactedNoTXManagerTest.java
      - copied unchanged from r1159528, camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/processor/JavaDslTransactedNoTXManagerTest.java
Modified:
    camel/branches/camel-2.8.x/   (props changed)
    camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/NoSuchBeanException.java
    camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/TransactedDefinition.java

Propchange: camel/branches/camel-2.8.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/NoSuchBeanException.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/NoSuchBeanException.java?rev=1172823&r1=1172822&r2=1172823&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/NoSuchBeanException.java (original)
+++ camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/NoSuchBeanException.java Mon Sep 19 21:11:22 2011
@@ -31,7 +31,7 @@ public class NoSuchBeanException extends
     }
 
     public NoSuchBeanException(String name, String type) {
-        super("No bean could be found in the registry for: " + name + " of type: " + type);
+        super("No bean could be found in the registry" + (name != null ? " for: " + name : "") + " of type: " + type);
         this.name = name;
     }
 

Modified: camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/TransactedDefinition.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/TransactedDefinition.java?rev=1172823&r1=1172822&r2=1172823&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/TransactedDefinition.java (original)
+++ camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/model/TransactedDefinition.java Mon Sep 19 21:11:22 2011
@@ -24,6 +24,7 @@ import javax.xml.bind.annotation.XmlAttr
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlTransient;
 
+import org.apache.camel.NoSuchBeanException;
 import org.apache.camel.Processor;
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.processor.WrapProcessor;
@@ -191,6 +192,7 @@ public class TransactedDefinition extend
             answer = routeContext.lookup(PROPAGATION_REQUIRED, TransactedPolicy.class);
         }
 
+        // this logic only applies if we are a transacted policy
         // still no policy found then try lookup the platform transaction manager and use it as policy
         if (answer == null && type == TransactedPolicy.class) {
             Class tmClazz = routeContext.getCamelContext().getClassResolver().resolveClass("org.springframework.transaction.PlatformTransactionManager");
@@ -220,16 +222,15 @@ public class TransactedDefinition extend
                         ObjectHelper.invokeMethod(method, txPolicy, transactionManager);
                         return txPolicy;
                     } else {
-                        LOG.warn("Cannot create a transacted policy as camel-spring.jar is not on the classpath!");
+                        // camel-spring is missing on the classpath
+                        throw new RuntimeCamelException("Cannot create a transacted policy as camel-spring.jar is not on the classpath!");
                     }
                 } else {
-                    if (LOG.isDebugEnabled()) {
-                        if (maps.isEmpty()) {
-                            LOG.debug("No PlatformTransactionManager found in registry.");
-                        } else {
-                            LOG.debug("Found {} PlatformTransactionManager in registry. "
-                                    + "Cannot determine which one to use. Please configure a TransactionTemplate on the policy", maps.size());
-                        }
+                    if (maps.isEmpty()) {
+                        throw new NoSuchBeanException(null, "PlatformTransactionManager");
+                    } else {
+                        throw new IllegalArgumentException("Found " + maps.size() + " PlatformTransactionManager in registry. "
+                                + "Cannot determine which one to use. Please configure a TransactionTemplate on the transacted policy.");
                     }
                 }
             }