ws-wss4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r783293 - in /webservices/wss4j/branches/1_5_x-fixes: src/org/apache/ws/security/handler/WSHandler.java test/wssec/TestWSSecurityResultsOrder.java
Date Wed, 10 Jun 2009 11:21:25 GMT
Author: coheigea
Date: Wed Jun 10 11:21:25 2009
New Revision: 783293

URL: http://svn.apache.org/viewvc?rev=783293&view=rev
Log:
[WSS-147] - Backmerging for consistency.

Modified:
    webservices/wss4j/branches/1_5_x-fixes/src/org/apache/ws/security/handler/WSHandler.java
    webservices/wss4j/branches/1_5_x-fixes/test/wssec/TestWSSecurityResultsOrder.java

Modified: webservices/wss4j/branches/1_5_x-fixes/src/org/apache/ws/security/handler/WSHandler.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/1_5_x-fixes/src/org/apache/ws/security/handler/WSHandler.java?rev=783293&r1=783292&r2=783293&view=diff
==============================================================================
--- webservices/wss4j/branches/1_5_x-fixes/src/org/apache/ws/security/handler/WSHandler.java
(original)
+++ webservices/wss4j/branches/1_5_x-fixes/src/org/apache/ws/security/handler/WSHandler.java
Wed Jun 10 11:21:25 2009
@@ -301,10 +301,14 @@
     }
     
     protected boolean checkReceiverResultsAnyOrder(Vector wsResult, Vector actions) {
-        int resultActions = wsResult.size();
-        Vector actionsClone = (Vector)actions.clone();
+
+        java.util.List recordedActions = new Vector(actions.size());
+        for (int i = 0; i < actions.size(); i++) {
+            Integer action = (Integer)actions.get(i);
+            recordedActions.add(action);
+        }
         
-        for (int i = 0; i < resultActions; i++) {
+        for (int i = 0; i < wsResult.size(); i++) {
             final Integer actInt = (Integer) ((WSSecurityEngineResult) wsResult
                     .get(i)).get(WSSecurityEngineResult.TAG_ACTION);
             int act = actInt.intValue();
@@ -312,15 +316,12 @@
                 continue;
             }
             
-            int foundIndex = actionsClone.indexOf(actInt);
-            if (foundIndex == -1) {
+            if (!recordedActions.remove(actInt)) {
                 return false;
-            } else {
-                actionsClone.remove(foundIndex);
             }
         }
 
-        if (!actionsClone.isEmpty()) {
+        if (!recordedActions.isEmpty()) {
             return false;
         }
 

Modified: webservices/wss4j/branches/1_5_x-fixes/test/wssec/TestWSSecurityResultsOrder.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/1_5_x-fixes/test/wssec/TestWSSecurityResultsOrder.java?rev=783293&r1=783292&r2=783293&view=diff
==============================================================================
--- webservices/wss4j/branches/1_5_x-fixes/test/wssec/TestWSSecurityResultsOrder.java (original)
+++ webservices/wss4j/branches/1_5_x-fixes/test/wssec/TestWSSecurityResultsOrder.java Wed
Jun 10 11:21:25 2009
@@ -109,6 +109,7 @@
         
         assertFalse (handler.checkResults(results, actions));
         assertTrue (handler.checkResultsAnyOrder(results, actions));
+        assertTrue (results.size() == 4 && actions.size() == 3);
     }
     
     /**
@@ -255,6 +256,32 @@
         assertFalse (handler.checkResults(results, actions));
         assertFalse (handler.checkResultsAnyOrder(results, actions));
     }
+
+    /**
+     */
+    public void 
+    testMultipleIdenticalResults() throws Exception {
+        MyHandler handler = new MyHandler();
+        
+        java.util.Vector results = new java.util.Vector();
+        results.add(
+            new WSSecurityEngineResult(WSConstants.ENCR, (Object)null)
+        );
+        results.add(
+            new WSSecurityEngineResult(WSConstants.UT, (Object)null)
+        );
+        results.add(
+            new WSSecurityEngineResult(WSConstants.ENCR, (Object)null)
+        );
+        
+        java.util.Vector actions = new java.util.Vector();
+        actions.add(new Integer(WSConstants.ENCR));
+        actions.add(new Integer(WSConstants.UT));
+        actions.add(new Integer(WSConstants.UT));
+        
+        assertFalse (handler.checkResults(results, actions));
+        assertFalse (handler.checkResultsAnyOrder(results, actions));
+    }
     
     /**
      * a trivial extension of the WSHandler type



---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org


Mime
View raw message