camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hadr...@apache.org
Subject svn commit: r1049343 - in /camel/trunk/camel-core/src: main/java/org/apache/camel/impl/DefaultCamelContext.java test/java/org/apache/camel/impl/DefaultCamelContextTest.java
Date Tue, 14 Dec 2010 23:54:37 GMT
Author: hadrian
Date: Tue Dec 14 23:54:36 2010
New Revision: 1049343

URL: http://svn.apache.org/viewvc?rev=1049343&view=rev
Log:
CAMEL-3428. Patch applied with thanks

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextTest.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java?rev=1049343&r1=1049342&r2=1049343&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultCamelContext.java Tue
Dec 14 23:54:36 2010
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.impl;
 
+import static java.lang.String.format;
+
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
@@ -465,7 +467,9 @@ public class DefaultCamelContext extends
 
     public <T extends Endpoint> T getEndpoint(String name, Class<T> endpointType)
{
         Endpoint endpoint = getEndpoint(name);
-
+        if(endpoint == null){
+        	throw new IllegalArgumentException("No endpoint found with name: " + name);
+        }
         if (endpoint instanceof InterceptSendToEndpoint) {
             endpoint = ((InterceptSendToEndpoint) endpoint).getDelegate();
         }

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextTest.java?rev=1049343&r1=1049342&r2=1049343&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/impl/DefaultCamelContextTest.java
Tue Dec 14 23:54:36 2010
@@ -88,6 +88,16 @@ public class DefaultCamelContextTest ext
             // expected
         }
     }
+    
+    public void testGetEndPointByTypeUnknown(){
+    	DefaultCamelContext camelContext = new DefaultCamelContext();
+    	try {
+			camelContext.getEndpoint("unknown", Endpoint.class);
+			fail();
+		} catch (IllegalArgumentException e) {
+		}
+    }
+
 
     public void testRemoveEndpoint() throws Exception {
         DefaultCamelContext ctx = new DefaultCamelContext();
@@ -314,5 +324,4 @@ public class DefaultCamelContextTest ext
         assertEquals(false, ctx.isStarted());
         assertEquals(false, ctx.isSuspended());
     }
-
-}
+}
\ No newline at end of file



Mime
View raw message