You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by js...@apache.org on 2006/10/02 18:10:43 UTC

svn commit: r452104 - /incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/DefaultComponent.java

Author: jstrachan
Date: Mon Oct  2 09:10:43 2006
New Revision: 452104

URL: http://svn.apache.org/viewvc?view=rev&rev=452104
Log:
used a more applicable exception if bad endpoints are configured on a component

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

Modified: incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/DefaultComponent.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/DefaultComponent.java?view=diff&rev=452104&r1=452103&r2=452104
==============================================================================
--- incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/DefaultComponent.java (original)
+++ incubator/servicemix/trunk/servicemix-common/src/main/java/org/apache/servicemix/common/DefaultComponent.java Mon Oct  2 09:10:43 2006
@@ -27,6 +27,7 @@
 import javax.jbi.component.ComponentContext;
 import javax.jbi.component.ComponentLifeCycle;
 import javax.jbi.component.ServiceUnitManager;
+import javax.jbi.management.DeploymentException;
 import javax.jbi.messaging.MessageExchange;
 import javax.jbi.servicedesc.ServiceEndpoint;
 import java.util.Arrays;
@@ -191,7 +192,7 @@
         return endpoints;
     }
 
-    public void setEndpoints(Endpoint[] endpoints) {
+    public void setEndpoints(Endpoint[] endpoints) throws DeploymentException {
         for (int i = 0; i < endpoints.length; i++) {
             Endpoint endpoint = endpoints[i];
             validateEndpoint(endpoint);
@@ -202,7 +203,7 @@
     /**
      * Provides a hook to validate the statically configured endpoint
      */
-    protected void validateEndpoint(Endpoint endpoint) {
+    protected void validateEndpoint(Endpoint endpoint) throws DeploymentException {
         Class[] endpointClasses = getEndpointClasses();
         if (endpointClasses != null) {
             boolean valid = false;
@@ -213,7 +214,7 @@
                 }
             }
             if (!valid) {
-                throw new IllegalArgumentException("The endpoint: " + endpoint
+                throw new DeploymentException("The endpoint: " + endpoint
                         + " is not an instance of any of the allowable types: " + Arrays.asList(endpointClasses));
             }
         }