You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by hi...@apache.org on 2011/06/03 10:04:54 UTC

svn commit: r1130933 - /synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/nhttp/HttpCoreNIOListener.java

Author: hiranya
Date: Fri Jun  3 08:04:54 2011
New Revision: 1130933

URL: http://svn.apache.org/viewvc?rev=1130933&view=rev
Log:
Adding a null check to prevent generating wrong EPRs before the transport is initialized

Modified:
    synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/nhttp/HttpCoreNIOListener.java

Modified: synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/nhttp/HttpCoreNIOListener.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/nhttp/HttpCoreNIOListener.java?rev=1130933&r1=1130932&r2=1130933&view=diff
==============================================================================
--- synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/nhttp/HttpCoreNIOListener.java (original)
+++ synapse/trunk/java/modules/transports/core/nhttp/src/main/java/org/apache/synapse/transport/nhttp/HttpCoreNIOListener.java Fri Jun  3 08:04:54 2011
@@ -67,7 +67,7 @@ public class HttpCoreNIOListener impleme
     private String customEPRPrefix;
     /** The custom URI map for the services if there are any */
     private Map<String, String> serviceNameToEPRMap = new HashMap<String, String>();
-    /** The servicename map for the custom URI if there are any */
+    /** The service name map for the custom URI if there are any */
     private Map<String, String> eprToServiceNameMap = new HashMap<String, String>();
     /** the axis observer that gets notified of service life cycle events*/
     private final AxisObserver axisObserver = new GenericAxisObserver();
@@ -386,23 +386,26 @@ public class HttpCoreNIOListener impleme
      */
     public EndpointReference getEPRForService(String serviceName, String ip) throws AxisFault {
 
-        String trailler = "";
+        String trailer = "";
         //Strip out the operation name
         if (serviceName.indexOf('/') != -1) {
-            trailler += serviceName.substring(serviceName.indexOf("/"));
+            trailer += serviceName.substring(serviceName.indexOf("/"));
             serviceName = serviceName.substring(0, serviceName.indexOf('/'));
         }
         // strip out the endpoint name if present
         if (serviceName.indexOf('.') != -1) {
-            trailler += serviceName.substring(serviceName.indexOf("."));
+            trailer += serviceName.substring(serviceName.indexOf("."));
             serviceName = serviceName.substring(0, serviceName.indexOf('.'));
         }
 
         if (serviceNameToEPRMap.containsKey(serviceName)) {
             return new EndpointReference(
-                    customEPRPrefix + serviceNameToEPRMap.get(serviceName) + trailler);
+                    customEPRPrefix + serviceNameToEPRMap.get(serviceName) + trailer);
         } else {
-            return new EndpointReference(serviceEPRPrefix + serviceName + trailler);
+            if (serviceEPRPrefix == null) {
+                return null;
+            }
+            return new EndpointReference(serviceEPRPrefix + serviceName + trailer);
         }
     }
 
@@ -415,25 +418,27 @@ public class HttpCoreNIOListener impleme
      */
     public EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault {
 
-        String trailler = "";
+        String trailer = "";
         //Strip out the operation name
         if (serviceName.indexOf('/') != -1) {
-            trailler += serviceName.substring(serviceName.indexOf("/"));
+            trailer += serviceName.substring(serviceName.indexOf("/"));
             serviceName = serviceName.substring(0, serviceName.indexOf('/'));
         }
         // strip out the endpoint name if present
         if (serviceName.indexOf('.') != -1) {
-            trailler += serviceName.substring(serviceName.indexOf("."));
+            trailer += serviceName.substring(serviceName.indexOf("."));
             serviceName = serviceName.substring(0, serviceName.indexOf('.'));
         }
 
         EndpointReference[] endpointReferences = new EndpointReference[1];
         if (serviceNameToEPRMap.containsKey(serviceName)) {
             endpointReferences[0] = new EndpointReference(
-                    customEPRPrefix + serviceNameToEPRMap.get(serviceName) + trailler);
+                    customEPRPrefix + serviceNameToEPRMap.get(serviceName) + trailer);
         } else {
-            endpointReferences[0]
-                    = new EndpointReference(serviceEPRPrefix + serviceName + trailler);
+            if (serviceEPRPrefix == null) {
+                return null;
+            }
+            endpointReferences[0] = new EndpointReference(serviceEPRPrefix + serviceName + trailer);
         }
         return endpointReferences;
     }