You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by he...@apache.org on 2006/03/06 14:09:03 UTC

svn commit: r383528 - /webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/Phase.java

Author: hemapani
Date: Mon Mar  6 05:08:59 2006
New Revision: 383528

URL: http://svn.apache.org/viewcvs?rev=383528&view=rev
Log:
fixed  http://issues.apache.org/jira/browse/AXIS2-456

Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/Phase.java

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/Phase.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/Phase.java?rev=383528&r1=383527&r2=383528&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/Phase.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/Phase.java Mon Mar  6 05:08:59 2006
@@ -124,6 +124,10 @@
      * @throws PhaseException
      */
     public void addHandler(HandlerDescription handler) throws PhaseException {
+    		
+    		if(handler.getName().getLocalPart().equals("CapabilityHandler")){
+    			System.out.println(handler.getName());
+    		}
         Iterator handlers_itr = getHandlers().iterator();
 
         while (handlers_itr.hasNext()) {
@@ -233,6 +237,13 @@
     private void insertBefore(Handler handler) throws PhaseException {
         String beforename = handler.getHandlerDesc().getRules().getBefore();
 
+        
+        
+        //we keep going foward, till the before handler is found, if we do not find him just add the handler
+        //once we found the before handler 
+        
+        int beforeHandlerIndex = -1;
+        
         for (int i = 0; i < handlers.size(); i++) {
             Handler temphandler = (Handler) handlers.get(i);
 
@@ -243,18 +254,18 @@
                                 + temphandler.getName()
                                 + "', which is marked phaseFirst");
                     }
-
-                    handlers.add(0, handler);
-
-                    return;
                 }
-
-                handlers.add(i - 1, handler);
+                beforeHandlerIndex = i;
+                break;
             }
         }
-
-        // added as last handler
-        addHandler(handler);
+        
+        if(beforeHandlerIndex >= 0){
+        		//java arraylist does the shift for us
+        		handlers.add(beforeHandlerIndex,handler);
+        }else{
+        		handlers.add(handler);
+        }
     }
 
     /**