Author: jstrachan
Date: Sun Oct  8 04:33:35 2006
New Revision: 454128

URL: http://svn.apache.org/viewvc?view=rev&rev=454128
Log:
added better error messages if a component is badly configured

Modified:
    
incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/EndpointSupport.java

Modified: 
incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/EndpointSupport.java
URL: 
http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/EndpointSupport.java?view=diff&rev=454128&r1=454127&r2=454128
==============================================================================
--- 
incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/EndpointSupport.java
 (original)
+++ 
incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/EndpointSupport.java
 Sun Oct  8 04:33:35 2006
@@ -27,11 +27,27 @@
     }
     
     public static String getKey(ServiceEndpoint endpoint) {
-        return getKey(endpoint.getServiceName(), endpoint.getEndpointName());
+        QName serviceName = endpoint.getServiceName();
+        if (serviceName == null) {
+            throw new IllegalArgumentException("Endpoint: " + endpoint + " has 
no serviceName defined");
+        }
+        String endpointName = endpoint.getEndpointName();
+        if (endpointName == null) {
+            throw new IllegalArgumentException("Endpoint: " + endpoint + " has 
no endpointName defined");
+        }
+        return getKey(serviceName, endpointName);
     }
     
     public static String getKey(Endpoint endpoint) {
-        return getKey(endpoint.getService(), endpoint.getEndpoint());
+        QName serviceName = endpoint.getService();
+        if (serviceName == null) {
+            throw new IllegalArgumentException("Endpoint: " + endpoint + " has 
no service name defined");
+        }
+        String endpointName = endpoint.getEndpoint();
+        if (endpointName == null) {
+            throw new IllegalArgumentException("Endpoint: " + endpoint + " has 
no endpoint name defined");
+        }
+        return getKey(serviceName, endpointName);
     }
     
 }


Reply via email to