Author: ruwan
Date: Mon Dec  8 03:18:51 2008
New Revision: 26195
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=26195

Log:
Fixing an issue in the indirect endpoint

Modified:
   
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/endpoints/IndirectEndpoint.java

Modified: 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/endpoints/IndirectEndpoint.java
URL: 
http://wso2.org/svn/browse/wso2/branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/endpoints/IndirectEndpoint.java?rev=26195&r1=26194&r2=26195&view=diff
==============================================================================
--- 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/endpoints/IndirectEndpoint.java
   (original)
+++ 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/endpoints/IndirectEndpoint.java
   Mon Dec  8 03:18:51 2008
@@ -24,6 +24,7 @@
 import org.apache.synapse.MessageContext;
 import org.apache.synapse.SynapseConstants;
 import org.apache.synapse.config.SynapseConfiguration;
+import org.apache.synapse.core.axis2.Axis2MessageContext;
 
 import java.util.List;
 
@@ -41,7 +42,14 @@
      * @param synCtx the message to send
      */
     public void send(MessageContext synCtx) {
-        realEndpoint.send(synCtx);
+        if (realEndpoint == null) {
+            init(((Axis2MessageContext) 
synCtx).getAxis2MessageContext().getConfigurationContext());
+        }
+        if (realEndpoint != null) {
+            realEndpoint.send(synCtx);
+        } else {
+            handleException("Couldn't find the endpoint with the key : " + 
key);
+        }
     }
 
     public String getKey() {
@@ -94,10 +102,7 @@
             SynapseConfiguration synCfg = (SynapseConfiguration) 
param.getValue();
             realEndpoint = synCfg.getEndpoint(key);
         }
-        if (realEndpoint == null) {
-            handleException("Unable to load endpoint with key : " + key);
-        }
-        if (!realEndpoint.isInitialized()) {
+        if (realEndpoint != null && !realEndpoint.isInitialized()) {
             realEndpoint.init(cc);
         }
     }

_______________________________________________
Esb-java-dev mailing list
[email protected]
https://wso2.org/cgi-bin/mailman/listinfo/esb-java-dev

Reply via email to