Author: keith
Date: Tue Jul 29 00:03:46 2008
New Revision: 20075
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=20075

Log:
If the axisService is null we have to throw an error



Modified:
   
branches/mashup/java/1.5/java/modules/core/src/org/wso2/mashup/requestprocessor/TryItProcessor.java

Modified: 
branches/mashup/java/1.5/java/modules/core/src/org/wso2/mashup/requestprocessor/TryItProcessor.java
URL: 
http://wso2.org/svn/browse/wso2/branches/mashup/java/1.5/java/modules/core/src/org/wso2/mashup/requestprocessor/TryItProcessor.java?rev=20075&r1=20074&r2=20075&view=diff
==============================================================================
--- 
branches/mashup/java/1.5/java/modules/core/src/org/wso2/mashup/requestprocessor/TryItProcessor.java
 (original)
+++ 
branches/mashup/java/1.5/java/modules/core/src/org/wso2/mashup/requestprocessor/TryItProcessor.java
 Tue Jul 29 00:03:46 2008
@@ -46,6 +46,15 @@
                     .getServiceForActivation(serviceName);
             OutputStream outputStream = response.getOutputStream();
 
+            if (axisService == null) {
+                response.setContentType("text/html");
+                response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+                outputStream
+                        .write(("<h4>Service cannot be found. Cannot display 
<em>TryIt</em>.</h4>").getBytes());
+                outputStream.flush();
+                return;
+            }
+
             // This is a fix for Mashup-861. If the transport is disabled we 
redirect the user to
             // the alternative transport
             StringBuffer url = request.getRequestURL();
@@ -100,29 +109,20 @@
                 return;
             }
 
-            if (axisService != null) {
-                if (!axisService.isActive()) {
-                    response.setContentType("text/html");
-                    response.setStatus(HttpServletResponse.SC_NOT_FOUND);
-                    outputStream
-                            .write(("<h4>Service " + serviceName +
-                                    " is inactive. Cannot display 
<em>TryIt</em>.</h4>")
-                                    .getBytes());
-                    outputStream.flush();
-                    return;
-                }
-
-                String serviceParameter = request.getParameter("service");
-                String endpointParameter = request.getParameter("endpoint");
-                Utils.writeTryIt(response, axisService, serviceParameter, 
endpointParameter);
-
-            } else {
+            if (!axisService.isActive()) {
                 response.setContentType("text/html");
                 response.setStatus(HttpServletResponse.SC_NOT_FOUND);
                 outputStream
-                        .write(("<h4>Service cannot be found. Cannot display 
<em>TryIt</em>.</h4>").getBytes());
+                        .write(("<h4>Service " + serviceName +
+                                " is inactive. Cannot display 
<em>TryIt</em>.</h4>")
+                                .getBytes());
                 outputStream.flush();
+                return;
             }
+
+            String serviceParameter = request.getParameter("service");
+            String endpointParameter = request.getParameter("endpoint");
+            Utils.writeTryIt(response, axisService, serviceParameter, 
endpointParameter);
         } catch (OMException e) {
             log.error(e);
         } catch (Exception e) {

_______________________________________________
Mashup-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/mashup-dev

Reply via email to