You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2012/01/13 20:17:47 UTC

svn commit: r1231256 [2/2] - in /cxf/branches/2.5.x-fixes: ./ rt/databinding/jaxb/src/main/java/org/apache/cxf/jaxb/ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/xml/ services/sts/sts-core/src/test/java/org/apache/cxf/sts/ldap/ systests/jax...

Modified: cxf/branches/2.5.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSIBPValidator.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSIBPValidator.java?rev=1231256&r1=1231255&r2=1231256&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSIBPValidator.java (original)
+++ cxf/branches/2.5.x-fixes/tools/validator/src/main/java/org/apache/cxf/tools/validator/internal/WSIBPValidator.java Fri Jan 13 19:17:44 2012
@@ -144,7 +144,7 @@ public class WSIBPValidator extends Abst
         int inmessagePartsCount = partsList.size();
         SoapBody soapBody = SOAPBindingUtil.getBindingInputSOAPBody(bop);
         if (soapBody != null) {
-            List parts = soapBody.getParts();
+            List<?> parts = soapBody.getParts();
             int boundPartSize = parts == null ? inmessagePartsCount : parts.size();
             SoapHeader soapHeader = SOAPBindingUtil.getBindingInputSOAPHeader(bop);
             boundPartSize = soapHeader != null
@@ -154,7 +154,7 @@ public class WSIBPValidator extends Abst
                 ? boundPartSize - 1 : boundPartSize;
 
             if (parts != null) {
-                Iterator partsIte = parts.iterator();
+                Iterator<?> partsIte = parts.iterator();
                 while (partsIte.hasNext()) {
                     String partName = (String)partsIte.next();
                     boolean isDefined = false;
@@ -194,7 +194,7 @@ public class WSIBPValidator extends Abst
         int outmessagePartsCount = wsdlHelper.getOutMessageParts(operation).size();
         SoapBody soapBody = SOAPBindingUtil.getBindingOutputSOAPBody(bop);
         if (soapBody != null) {
-            List parts = soapBody.getParts();
+            List<?> parts = soapBody.getParts();
             int boundPartSize = parts == null ? outmessagePartsCount : parts.size();
             SoapHeader soapHeader = SOAPBindingUtil.getBindingOutputSOAPHeader(bop);
             boundPartSize = soapHeader != null
@@ -203,7 +203,7 @@ public class WSIBPValidator extends Abst
                     .getQName())
                 ? boundPartSize - 1 : boundPartSize;
             if (parts != null) {
-                Iterator partsIte = parts.iterator();
+                Iterator<?> partsIte = parts.iterator();
                 while (partsIte.hasNext()) {
                     String partName = (String)partsIte.next();
                     boolean isDefined = false;
@@ -240,7 +240,7 @@ public class WSIBPValidator extends Abst
 
     public boolean checkBinding() {
         for (PortType portType : wsdlHelper.getPortTypes(def)) {
-            Iterator ite = portType.getOperations().iterator();
+            Iterator<?> ite = portType.getOperations().iterator();
             while (ite.hasNext()) {
                 Operation operation = (Operation)ite.next();
                 if (isOverloading(operation.getName())) {
@@ -293,8 +293,8 @@ public class WSIBPValidator extends Abst
 
     public boolean checkR2203And2204() {
 
-        for (Iterator ite = def.getBindings().values().iterator(); ite.hasNext();) {
-            Binding binding = (Binding)ite.next();
+        Collection<Binding> bindings = CastUtils.cast(def.getBindings().values());
+        for (Binding binding: bindings) {
 
             String style = SOAPBindingUtil.getCanonicalBindingStyle(binding);
             
@@ -304,13 +304,13 @@ public class WSIBPValidator extends Abst
 
             //
 
-            for (Iterator ite2 = binding.getPortType().getOperations().iterator(); ite2.hasNext();) {
+            for (Iterator<?> ite2 = binding.getPortType().getOperations().iterator(); ite2.hasNext();) {
                 Operation operation = (Operation)ite2.next();
                 BindingOperation bop = wsdlHelper.getBindingOperation(def, operation.getName());
                 if (operation.getInput() != null && operation.getInput().getMessage() != null) {
                     Message inMess = operation.getInput().getMessage();
 
-                    for (Iterator ite3 = inMess.getParts().values().iterator(); ite3.hasNext();) {
+                    for (Iterator<?> ite3 = inMess.getParts().values().iterator(); ite3.hasNext();) {
                         Part p = (Part)ite3.next();
                         if (SOAPBinding.Style.RPC.name().equalsIgnoreCase(style) && p.getTypeName() == null
                             && !isHeaderPart(bop, p)) {
@@ -334,7 +334,7 @@ public class WSIBPValidator extends Abst
                 }
                 if (operation.getOutput() != null && operation.getOutput().getMessage() != null) {
                     Message outMess = operation.getOutput().getMessage();
-                    for (Iterator ite3 = outMess.getParts().values().iterator(); ite3.hasNext();) {
+                    for (Iterator<?> ite3 = outMess.getParts().values().iterator(); ite3.hasNext();) {
                         Part p = (Part)ite3.next();
                         if (style.equalsIgnoreCase(SOAPBinding.Style.RPC.name()) && p.getTypeName() == null
                             &&  !isHeaderPart(bop, p)) {
@@ -364,8 +364,8 @@ public class WSIBPValidator extends Abst
 
     // TODO: Should also check SoapHeader/SoapHeaderFault
     public boolean checkR2205() {
-        for (Iterator ite = def.getBindings().values().iterator(); ite.hasNext();) {
-            Binding binding = (Binding)ite.next();
+        Collection<Binding> bindings = CastUtils.cast(def.getBindings().values());
+        for (Binding binding: bindings) {
 
             if (!SOAPBindingUtil.isSOAPBinding(binding)) {
                 System.err.println("WSIBP Validator found <"
@@ -373,7 +373,7 @@ public class WSIBPValidator extends Abst
                 continue;
             }
 
-            for (Iterator ite2 = binding.getPortType().getOperations().iterator(); ite2.hasNext();) {
+            for (Iterator<?> ite2 = binding.getPortType().getOperations().iterator(); ite2.hasNext();) {
                 Operation operation = (Operation)ite2.next();
                 Collection<Fault> faults = CastUtils.cast(operation.getFaults().values());
                 if (CollectionUtils.isEmpty(faults)) {
@@ -398,10 +398,8 @@ public class WSIBPValidator extends Abst
     }
 
     public boolean checkR2705() {
-        Iterator ite = def.getBindings().values().iterator();
-        while (ite.hasNext()) {
-            Object obj = ite.next();
-            Binding binding = (Binding)obj;
+        Collection<Binding> bindings = CastUtils.cast(def.getBindings().values());
+        for (Binding binding: bindings) {
             if (SOAPBindingUtil.isMixedStyle(binding)) {
                 addErrorMessage("Mixed style, invalid WSDL");
                 return false;

Modified: cxf/branches/2.5.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/JAXWSBindingParser.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/JAXWSBindingParser.java?rev=1231256&r1=1231255&r2=1231256&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/JAXWSBindingParser.java (original)
+++ cxf/branches/2.5.x-fixes/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/JAXWSBindingParser.java Fri Jan 13 19:17:44 2012
@@ -251,7 +251,7 @@ public class JAXWSBindingParser {
             throw new UnsupportedOperationException();
         }
 
-        public Iterator getPrefixes(String namespaceURI) {
+        public Iterator<?> getPrefixes(String namespaceURI) {
             throw new UnsupportedOperationException();
         }
     }

Modified: cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/WSDLToService.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/WSDLToService.java?rev=1231256&r1=1231255&r2=1231256&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/WSDLToService.java (original)
+++ cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/WSDLToService.java Fri Jan 13 19:17:44 2012
@@ -44,7 +44,7 @@ public class WSDLToService extends Abstr
         super(TOOL_NAME, toolspec);
     }
 
-    private Set getArrayKeys() {
+    private Set<String> getArrayKeys() {
         return new HashSet<String>();
     }
 

Modified: cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/WSDLToSoap.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/WSDLToSoap.java?rev=1231256&r1=1231255&r2=1231256&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/WSDLToSoap.java (original)
+++ cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/WSDLToSoap.java Fri Jan 13 19:17:44 2012
@@ -47,7 +47,7 @@ public class WSDLToSoap extends Abstract
         super(TOOL_NAME, toolspec);
     }
     
-    private Set getArrayKeys() {
+    private Set<String> getArrayKeys() {
         return new HashSet<String>();
     }
     

Modified: cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/WSDLToXML.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/WSDLToXML.java?rev=1231256&r1=1231255&r2=1231256&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/WSDLToXML.java (original)
+++ cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/WSDLToXML.java Fri Jan 13 19:17:44 2012
@@ -47,7 +47,7 @@ public class WSDLToXML extends AbstractC
         super(TOOL_NAME, toolspec);
     }
     
-    private Set getArrayKeys() {
+    private Set<String> getArrayKeys() {
         return new HashSet<String>();
     }
     

Modified: cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/XSDToWSDL.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/XSDToWSDL.java?rev=1231256&r1=1231255&r2=1231256&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/XSDToWSDL.java (original)
+++ cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/XSDToWSDL.java Fri Jan 13 19:17:44 2012
@@ -45,7 +45,7 @@ public class XSDToWSDL extends AbstractC
         super(TOOL_NAME, toolspec);
     }
 
-    private Set getArrayKeys() {
+    private Set<String> getArrayKeys() {
         return new HashSet<String>();
     }
 

Modified: cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessor.java?rev=1231256&r1=1231255&r2=1231256&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessor.java (original)
+++ cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessor.java Fri Jan 13 19:17:44 2012
@@ -21,7 +21,6 @@ package org.apache.cxf.tools.misc.proces
 
 import java.io.IOException;
 import java.io.Writer;
-import java.util.Iterator;
 import java.util.Map;
 import javax.wsdl.Binding;
 import javax.wsdl.Port;
@@ -33,6 +32,7 @@ import javax.xml.namespace.QName;
 
 import org.apache.cxf.common.WSDLConstants;
 import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolException;
 import org.apache.cxf.tools.misc.processor.address.Address;
@@ -43,9 +43,9 @@ public class WSDLToServiceProcessor exte
 
     private static final String NEW_FILE_NAME_MODIFIER = "-service";
 
-    private Map services;
+    private Map<QName, Service> services;
     private Service service;
-    private Map ports;
+    private Map<String, Port> ports;
     private Port port;
     private Binding binding;
 
@@ -67,13 +67,11 @@ public class WSDLToServiceProcessor exte
     }
 
     private boolean isServiceExisted() {
-        services = wsdlDefinition.getServices();
+        services = CastUtils.cast(wsdlDefinition.getServices());
         if (services == null) {
             return false;
         }
-        Iterator it = services.keySet().iterator();
-        while (it.hasNext()) {
-            QName serviceQName = (QName)it.next();
+        for (QName serviceQName: services.keySet()) {
             String serviceName = serviceQName.getLocalPart();
             if (serviceName.equals(env.get(ToolConstants.CFG_SERVICE))) {
                 service = (Service)services.get(serviceQName);
@@ -84,15 +82,13 @@ public class WSDLToServiceProcessor exte
     }
 
     private boolean isPortExisted() {
-        ports = service.getPorts();
+        ports = CastUtils.cast(service.getPorts());
         if (ports == null) {
             return false;
         }
-        Iterator it = ports.keySet().iterator();
-        while (it.hasNext()) {
-            String portName = (String)it.next();
+        for (String portName: ports.keySet()) {
             if (portName.equals(env.get(ToolConstants.CFG_PORT))) {
-                port = (Port)ports.get(portName);
+                port = ports.get(portName);
                 break;
             }
         }
@@ -100,17 +96,15 @@ public class WSDLToServiceProcessor exte
     }
 
     private boolean isBindingExisted() {
-        Map bindings = wsdlDefinition.getBindings();
+        Map<QName, Binding> bindings = CastUtils.cast(wsdlDefinition.getBindings());
         if (bindings == null) {
             return false;
         }
-        Iterator it = bindings.keySet().iterator();
-        while (it.hasNext()) {
-            QName bindingQName = (QName)it.next();
+        for (QName bindingQName: bindings.keySet()) {
             String bindingName = bindingQName.getLocalPart();
             String attrBinding = (String)env.get(ToolConstants.CFG_BINDING_ATTR);
             if (attrBinding.equals(bindingName)) {
-                binding = (Binding)bindings.get(bindingQName);
+                binding = bindings.get(bindingQName);
             }
         }
         return (binding == null) ? false : true;

Modified: cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToSoapProcessor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToSoapProcessor.java?rev=1231256&r1=1231255&r2=1231256&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToSoapProcessor.java (original)
+++ cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToSoapProcessor.java Fri Jan 13 19:17:44 2012
@@ -21,7 +21,7 @@ package org.apache.cxf.tools.misc.proces
 
 import java.io.IOException;
 import java.io.Writer;
-import java.util.Iterator;
+import java.util.Collection;
 import java.util.List;
 import java.util.Map;
 
@@ -42,6 +42,7 @@ import javax.xml.namespace.QName;
 
 import org.apache.cxf.common.WSDLConstants;
 import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolException;
 import org.apache.cxf.tools.common.extensions.soap.SoapBinding;
@@ -55,7 +56,7 @@ public class WSDLToSoapProcessor extends
 
     private static final String NEW_FILE_NAME_MODIFIER = "-soapbinding";
 
-    private Map portTypes;
+    private Map<QName, PortType> portTypes;
     private PortType portType;
     private Binding binding;
 
@@ -83,14 +84,13 @@ public class WSDLToSoapProcessor extends
             throw new ToolException(msg);
         }
         if (WSDLConstants.RPC.equalsIgnoreCase((String)env.get(ToolConstants.CFG_STYLE))) {
-            Iterator it = portType.getOperations().iterator();
-            while (it.hasNext()) {
-                Operation op = (Operation)it.next();
+            Collection<Operation> ops = CastUtils.cast(portType.getOperations());
+                
+            for (Operation op : ops) {
                 Input input = op.getInput();
                 if (input != null && input.getMessage() != null) {
-                    Iterator itParts = input.getMessage().getParts().values().iterator();
-                    while (itParts.hasNext()) {
-                        Part part = (Part)itParts.next();
+                    Collection<Part> parts = CastUtils.cast(input.getMessage().getParts().values());
+                    for (Part part: parts) {
                         if (part.getTypeName() == null || "".equals(part.getTypeName().toString())) {
                             Message msg = new Message("RPC_PART_ILLEGAL", LOG, new Object[] {part.getName()});
                             throw new ToolException(msg);
@@ -99,9 +99,8 @@ public class WSDLToSoapProcessor extends
                 }
                 Output output = op.getOutput();
                 if (output != null && output.getMessage() != null) {
-                    Iterator itParts = output.getMessage().getParts().values().iterator();
-                    while (itParts.hasNext()) {
-                        Part part = (Part)itParts.next();
+                    Collection<Part> parts = CastUtils.cast(output.getMessage().getParts().values());
+                    for (Part part: parts) {
                         if (part.getTypeName() == null || "".equals(part.getTypeName().toString())) {
                             Message msg = new Message("RPC_PART_ILLEGAL", LOG, new Object[] {part.getName()});
                             throw new ToolException(msg);
@@ -113,16 +112,14 @@ public class WSDLToSoapProcessor extends
     }
 
     private boolean isPortTypeExisted() {
-        portTypes = wsdlDefinition.getPortTypes();
+        portTypes = CastUtils.cast(wsdlDefinition.getPortTypes());
         if (portTypes == null) {
             return false;
         }
-        Iterator it = portTypes.keySet().iterator();
-        while (it.hasNext()) {
-            QName existPortQName = (QName)it.next();
+        for (QName existPortQName : portTypes.keySet()) {
             String existPortName = existPortQName.getLocalPart();
             if (existPortName.equals(env.get(ToolConstants.CFG_PORTTYPE))) {
-                portType = (PortType)portTypes.get(existPortQName);
+                portType = portTypes.get(existPortQName);
                 break;
             }
         }
@@ -130,17 +127,15 @@ public class WSDLToSoapProcessor extends
     }
 
     private boolean isBindingExisted() {
-        Map bindings = wsdlDefinition.getBindings();
+        Map<QName, Binding> bindings = CastUtils.cast(wsdlDefinition.getBindings());
         if (bindings == null) {
             return false;
         }
-        Iterator it = bindings.keySet().iterator();
-        while (it.hasNext()) {
-            QName existBindingQName = (QName)it.next();
+        for (QName existBindingQName : bindings.keySet()) {
             String existBindingName = existBindingQName.getLocalPart();
             String bindingName = (String)env.get(ToolConstants.CFG_BINDING);
             if (bindingName.equals(existBindingName)) {
-                binding = (Binding)bindings.get(existBindingQName);
+                binding = bindings.get(existBindingQName);
             }
         }
         return (binding == null) ? false : true;
@@ -292,11 +287,8 @@ public class WSDLToSoapProcessor extends
     }
 
     private void addSoapFaults(Operation op, BindingOperation bindingOperation) throws ToolException {
-        Map faults = op.getFaults();
-        Iterator it = faults.keySet().iterator();
-        while (it.hasNext()) {
-            String key = (String)it.next();
-            Fault fault = (Fault)faults.get(key);
+        Map<String, Fault> faults = CastUtils.cast(op.getFaults());
+        for (Fault fault : faults.values()) {
             BindingFault bf = wsdlDefinition.createBindingFault();
             bf.setName(fault.getName());
             setSoapFaultExtElement(bf);

Modified: cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToXMLProcessor.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToXMLProcessor.java?rev=1231256&r1=1231255&r2=1231256&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToXMLProcessor.java (original)
+++ cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/main/java/org/apache/cxf/tools/misc/processor/WSDLToXMLProcessor.java Fri Jan 13 19:17:44 2012
@@ -22,7 +22,6 @@ package org.apache.cxf.tools.misc.proces
 import java.io.IOException;
 import java.io.Writer;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import javax.wsdl.Binding;
@@ -42,6 +41,7 @@ import javax.xml.namespace.QName;
 
 import org.apache.cxf.common.WSDLConstants;
 import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolException;
 import org.apache.cxf.tools.misc.processor.address.Address;
@@ -52,12 +52,12 @@ public class WSDLToXMLProcessor extends 
 
     private static final String NEW_FILE_NAME_MODIFIER = "-xmlbinding";
 
-    private Map services;
+    private Map<QName, Service> services;
     private Service service;
-    private Map ports;
+    private Map<String, Port> ports;
     private Port port;
 
-    private Map portTypes;
+    private Map<QName, PortType> portTypes;
     private PortType portType;
     private Binding binding;
 
@@ -85,16 +85,14 @@ public class WSDLToXMLProcessor extends 
     }
 
     private boolean isServiceExisted() {
-        services = wsdlDefinition.getServices();
+        services = CastUtils.cast(wsdlDefinition.getServices());
         if (services == null) {
             return false;
         }
-        Iterator it = services.keySet().iterator();
-        while (it.hasNext()) {
-            QName serviceQName = (QName)it.next();
+        for (QName serviceQName : services.keySet()) {
             String serviceName = serviceQName.getLocalPart();
             if (serviceName.equals(env.get(ToolConstants.CFG_SERVICE))) {
-                service = (Service)services.get(serviceQName);
+                service = services.get(serviceQName);
                 break;
             }
         }
@@ -102,15 +100,13 @@ public class WSDLToXMLProcessor extends 
     }
 
     private boolean isPortExisted() {
-        ports = service.getPorts();
+        ports = CastUtils.cast(service.getPorts());
         if (ports == null) {
             return false;
         }
-        Iterator it = ports.keySet().iterator();
-        while (it.hasNext()) {
-            String portName = (String)it.next();
+        for (String portName : ports.keySet()) {
             if (portName.equals(env.get(ToolConstants.CFG_PORT))) {
-                port = (Port)ports.get(portName);
+                port = ports.get(portName);
                 break;
             }
         }
@@ -118,16 +114,14 @@ public class WSDLToXMLProcessor extends 
     }
 
     private boolean isPortTypeExisted() {
-        portTypes = wsdlDefinition.getPortTypes();
+        portTypes = CastUtils.cast(wsdlDefinition.getPortTypes());
         if (portTypes == null) {
             return false;
         }
-        Iterator it = portTypes.keySet().iterator();
-        while (it.hasNext()) {
-            QName existPortQName = (QName)it.next();
+        for (QName existPortQName: portTypes.keySet()) {
             String existPortName = existPortQName.getLocalPart();
             if (existPortName.equals(env.get(ToolConstants.CFG_PORTTYPE))) {
-                portType = (PortType)portTypes.get(existPortQName);
+                portType = portTypes.get(existPortQName);
                 break;
             }
         }
@@ -135,17 +129,15 @@ public class WSDLToXMLProcessor extends 
     }
 
     private boolean isBindingExisted() {
-        Map bindings = wsdlDefinition.getBindings();
+        Map<QName, Binding> bindings = CastUtils.cast(wsdlDefinition.getBindings());
         if (bindings == null) {
             return false;
         }
-        Iterator it = bindings.keySet().iterator();
-        while (it.hasNext()) {
-            QName existBindingQName = (QName)it.next();
+        for (QName existBindingQName : bindings.keySet()) {
             String existBindingName = existBindingQName.getLocalPart();
             String bindingName = (String)env.get(ToolConstants.CFG_BINDING);
             if (bindingName.equals(existBindingName)) {
-                binding = (Binding)bindings.get(existBindingQName);
+                binding = bindings.get(existBindingQName);
             }
         }
         return (binding == null) ? false : true;

Modified: cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessorTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessorTest.java?rev=1231256&r1=1231255&r2=1231256&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessorTest.java (original)
+++ cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToServiceProcessorTest.java Fri Jan 13 19:17:44 2012
@@ -68,7 +68,7 @@ public class WSDLToServiceProcessorTest 
             if (service == null) {
                 fail("Element wsdl:service serviceins Missed!");
             }
-            Iterator it = service.getPort("portins").getExtensibilityElements().iterator();
+            Iterator<?> it = service.getPort("portins").getExtensibilityElements().iterator();
             if (it == null || !it.hasNext()) {
                 fail("Element wsdl:port portins Missed!");
             }
@@ -116,7 +116,7 @@ public class WSDLToServiceProcessorTest 
             if (service == null) {
                 fail("Element wsdl:service serviceins Missed!");
             }
-            Iterator it = service.getPort("SoapPort").getExtensibilityElements().iterator();
+            Iterator<?> it = service.getPort("SoapPort").getExtensibilityElements().iterator();
             if (it == null || !it.hasNext()) {
                 fail("Element wsdl:port portins Missed!");
             }
@@ -158,7 +158,7 @@ public class WSDLToServiceProcessorTest 
             if (service == null) {
                 fail("Element wsdl:service serviceins Missed!");
             }
-            Iterator it = service.getPort("portins").getExtensibilityElements().iterator();
+            Iterator<?> it = service.getPort("portins").getExtensibilityElements().iterator();
             if (it == null || !it.hasNext()) {
                 fail("Element wsdl:port portins Missed!");
             }
@@ -207,7 +207,7 @@ public class WSDLToServiceProcessorTest 
             if (service == null) {
                 fail("Element wsdl:service serviceins Missed!");
             }
-            Iterator it = service.getPort("portins").getExtensibilityElements().iterator();
+            Iterator<?> it = service.getPort("portins").getExtensibilityElements().iterator();
             if (it == null || !it.hasNext()) {
                 fail("Element wsdl:port portins Missed!");
             }
@@ -264,7 +264,7 @@ public class WSDLToServiceProcessorTest 
             if (service == null) {
                 fail("Element wsdl:service serviceins Missed!");
             }
-            Iterator it = service.getPort("portins").getExtensibilityElements().iterator();
+            Iterator<?> it = service.getPort("portins").getExtensibilityElements().iterator();
             if (it == null || !it.hasNext()) {
                 fail("Element wsdl:port portins Missed!");
             }

Modified: cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToSoapProcessorTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToSoapProcessorTest.java?rev=1231256&r1=1231255&r2=1231256&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToSoapProcessorTest.java (original)
+++ cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToSoapProcessorTest.java Fri Jan 13 19:17:44 2012
@@ -77,10 +77,8 @@ public class WSDLToSoapProcessorTest ext
             if (binding == null) {
                 fail("Element wsdl:binding Greeter_Binding Missed!");
             }
-            Iterator it = binding.getExtensibilityElements().iterator();
             boolean found = false;
-            while (it.hasNext()) {
-                Object obj = it.next();
+            for (Object obj : binding.getExtensibilityElements()) {
                 SoapBinding soapBinding = SOAPBindingUtil.getSoapBinding(obj);
                 if (soapBinding != null
                     && soapBinding.getStyle().equalsIgnoreCase("document")) {
@@ -95,10 +93,8 @@ public class WSDLToSoapProcessorTest ext
             if (bo == null) {
                 fail("Element <wsdl:operation name=\"pingMe\"> Missed!");
             }
-            it = bo.getExtensibilityElements().iterator();
             found = false;
-            while (it.hasNext()) {
-                Object obj = it.next();
+            for (Object obj : bo.getExtensibilityElements()) {
                 SoapOperation soapOperation = SOAPBindingUtil.getSoapOperation(obj);
                 if (soapOperation != null
                     && soapOperation.getStyle().equalsIgnoreCase("document")) {
@@ -113,10 +109,8 @@ public class WSDLToSoapProcessorTest ext
             if (fault == null) {
                 fail("Element <wsdl:fault name=\"pingMeFault\"> Missed!");
             }
-            it = fault.getExtensibilityElements().iterator();
             found = false;
-            while (it.hasNext()) {
-                Object obj = it.next();
+            for (Object obj : fault.getExtensibilityElements()) {
                 if (SOAPBindingUtil.isSOAPFault(obj)) {
                     found = true;
                     break;
@@ -157,10 +151,8 @@ public class WSDLToSoapProcessorTest ext
             if (binding == null) {
                 fail("Element wsdl:binding Greeter_SOAPBinding_NewBinding Missed!");
             }
-            Iterator it = binding.getExtensibilityElements().iterator();
             boolean found = false;
-            while (it.hasNext()) {
-                Object obj = it.next();
+            for (Object obj : binding.getExtensibilityElements()) {
                 SoapBinding soapBinding = SOAPBindingUtil.getSoapBinding(obj);
                 if (soapBinding != null && soapBinding.getStyle().equalsIgnoreCase("rpc")) {
                     found = true;
@@ -175,10 +167,8 @@ public class WSDLToSoapProcessorTest ext
             if (bo == null) {
                 fail("Element <wsdl:operation name=\"sendReceiveData\"> Missed!");
             }
-            it = bo.getExtensibilityElements().iterator();
             found = false;
-            while (it.hasNext()) {
-                Object obj = it.next();
+            for (Object obj : bo.getExtensibilityElements()) {
                 SoapOperation soapOperation = SOAPBindingUtil.getSoapOperation(obj);
                 if (soapOperation != null && soapOperation.getStyle().equalsIgnoreCase("rpc")) {
                     found = true;
@@ -189,10 +179,8 @@ public class WSDLToSoapProcessorTest ext
                 fail("Element soap:operation style=rpc Missed!");
             }
             BindingInput bi = bo.getBindingInput();
-            it = bi.getExtensibilityElements().iterator();
             found = false;
-            while (it.hasNext()) {
-                Object obj = it.next();
+            for (Object obj : bi.getExtensibilityElements()) {
                 SoapBody soapBody = SOAPBindingUtil.getSoapBody(obj);
                 if (soapBody != null && soapBody.getUse().equalsIgnoreCase("literal")) {
                     found = true;
@@ -233,10 +221,7 @@ public class WSDLToSoapProcessorTest ext
             if (binding == null) {
                 fail("Element wsdl:binding Greeter_SOAPBinding_NewBinding Missed!");
             }
-            Iterator it = binding.getExtensibilityElements().iterator();
-
-            while (it.hasNext()) {
-                Object obj = it.next();
+            for (Object obj : binding.getExtensibilityElements()) {
                 assertTrue(SOAPBindingUtil.isSOAPBinding(obj));
                 assertTrue(obj instanceof SOAP12Binding);
                 SoapBinding soapBinding = SOAPBindingUtil.getSoapBinding(obj);
@@ -250,10 +235,7 @@ public class WSDLToSoapProcessorTest ext
             if (bo == null) {
                 fail("Element <wsdl:operation name=\"sayHi\"> Missed!");
             }
-            it = bo.getExtensibilityElements().iterator();
-
-            while (it.hasNext()) {
-                Object obj = it.next();
+            for (Object obj : bo.getExtensibilityElements()) {
                 assertTrue(SOAPBindingUtil.isSOAPOperation(obj));
                 assertTrue(obj instanceof SOAP12Operation);
                 SoapOperation soapOperation = SOAPBindingUtil.getSoapOperation(obj);
@@ -261,9 +243,7 @@ public class WSDLToSoapProcessorTest ext
                 assertTrue("document".equalsIgnoreCase(soapOperation.getStyle()));
             }
             BindingInput bi = bo.getBindingInput();
-            it = bi.getExtensibilityElements().iterator();
-            while (it.hasNext()) {
-                Object obj = it.next();
+            for (Object obj : bi.getExtensibilityElements()) {
                 assertTrue(SOAPBindingUtil.isSOAPBody(obj));
                 assertTrue(obj instanceof SOAP12Body);
                 SoapBody soapBody = SOAPBindingUtil.getSoapBody(obj);
@@ -299,10 +279,7 @@ public class WSDLToSoapProcessorTest ext
             if (binding == null) {
                 fail("Element wsdl:binding Greeter_SOAPBinding_NewBinding Missed!");
             }
-            Iterator it = binding.getExtensibilityElements().iterator();
-
-            while (it.hasNext()) {
-                Object obj = it.next();
+            for (Object obj : binding.getExtensibilityElements()) {
                 assertTrue(SOAPBindingUtil.isSOAPBinding(obj));
                 assertTrue(obj instanceof SOAP12Binding);
                 SoapBinding soapBinding = SOAPBindingUtil.getSoapBinding(obj);
@@ -315,10 +292,7 @@ public class WSDLToSoapProcessorTest ext
             if (bo == null) {
                 fail("Element <wsdl:operation name=\"sayHi\"> Missed!");
             }
-            it = bo.getExtensibilityElements().iterator();
-
-            while (it.hasNext()) {
-                Object obj = it.next();
+            for (Object obj : bo.getExtensibilityElements()) {
                 assertTrue(SOAPBindingUtil.isSOAPOperation(obj));
                 assertTrue(obj instanceof SOAP12Operation);
                 SoapOperation soapOperation = SOAPBindingUtil.getSoapOperation(obj);
@@ -326,9 +300,7 @@ public class WSDLToSoapProcessorTest ext
                 assertTrue("document".equalsIgnoreCase(soapOperation.getStyle()));
             }
             BindingInput bi = bo.getBindingInput();
-            it = bi.getExtensibilityElements().iterator();
-            while (it.hasNext()) {
-                Object obj = it.next();
+            for (Object obj : bi.getExtensibilityElements()) {
                 assertTrue(SOAPBindingUtil.isSOAPBody(obj));
                 assertTrue(obj instanceof SOAP12Body);
                 SoapBody soapBody = SOAPBindingUtil.getSoapBody(obj);
@@ -337,7 +309,7 @@ public class WSDLToSoapProcessorTest ext
             }
             bo = binding.getBindingOperation("pingMe", null, null);
             assertNotNull(bo);
-            it = bo.getExtensibilityElements().iterator();
+            Iterator<?> it = bo.getExtensibilityElements().iterator();
             assertTrue(it != null && it.hasNext());
             assertTrue(it.next() instanceof SOAP12Operation);
 
@@ -349,7 +321,7 @@ public class WSDLToSoapProcessorTest ext
             assertTrue(it != null && it.hasNext());
             assertTrue(it.next() instanceof SOAP12Body);
 
-            Map faults = bo.getBindingFaults();
+            Map<?, ?> faults = bo.getBindingFaults();
             assertTrue(faults != null && faults.size() == 1);
             Object bf = faults.get("pingMeFault");
             assertNotNull(bf);
@@ -409,10 +381,7 @@ public class WSDLToSoapProcessorTest ext
             if (binding == null) {
                 fail("Element wsdl:binding Greeter_SOAPBinding_NewBinding Missed!");
             }
-            Iterator it = binding.getExtensibilityElements().iterator();
-
-            while (it.hasNext()) {
-                Object obj = it.next();
+            for (Object obj : binding.getExtensibilityElements()) {
                 assertTrue(SOAPBindingUtil.isSOAPBinding(obj));
                 assertTrue(obj instanceof SOAPBinding);
                 SoapBinding soapBinding = SOAPBindingUtil.getSoapBinding(obj);
@@ -426,10 +395,7 @@ public class WSDLToSoapProcessorTest ext
             if (bo == null) {
                 fail("Element <wsdl:operation name=\"sayHi\"> Missed!");
             }
-            it = bo.getExtensibilityElements().iterator();
-
-            while (it.hasNext()) {
-                Object obj = it.next();
+            for (Object obj : bo.getExtensibilityElements()) {
                 assertTrue(SOAPBindingUtil.isSOAPOperation(obj));
                 assertTrue(obj instanceof SOAPOperation);
                 SoapOperation soapOperation = SOAPBindingUtil.getSoapOperation(obj);
@@ -437,9 +403,7 @@ public class WSDLToSoapProcessorTest ext
                 assertTrue("document".equalsIgnoreCase(soapOperation.getStyle()));
             }
             BindingInput bi = bo.getBindingInput();
-            it = bi.getExtensibilityElements().iterator();
-            while (it.hasNext()) {
-                Object obj = it.next();
+            for (Object obj : bi.getExtensibilityElements()) {
                 assertTrue(SOAPBindingUtil.isSOAPBody(obj));
                 assertTrue(obj instanceof SOAPBody);
                 SoapBody soapBody = SOAPBindingUtil.getSoapBody(obj);

Modified: cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToXMLProcessorTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToXMLProcessorTest.java?rev=1231256&r1=1231255&r2=1231256&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToXMLProcessorTest.java (original)
+++ cxf/branches/2.5.x-fixes/tools/wsdlto/misc/src/test/java/org/apache/cxf/tools/misc/processor/WSDLToXMLProcessorTest.java Fri Jan 13 19:17:44 2012
@@ -20,7 +20,6 @@
 package org.apache.cxf.tools.misc.processor;
 
 import java.io.File;
-import java.util.Iterator;
 
 import javax.wsdl.Binding;
 import javax.wsdl.BindingOperation;
@@ -67,10 +66,8 @@ public class WSDLToXMLProcessorTest exte
         if (binding == null) {
             fail("Element wsdl:binding Greeter_XMLBinding Missed!");
         }
-        Iterator it = binding.getExtensibilityElements().iterator();
         boolean found = false;
-        while (it.hasNext()) {
-            Object obj = it.next();
+        for (Object obj : binding.getExtensibilityElements()) {
             if (obj instanceof XMLFormatBinding) {
                 found = true;
                 break;
@@ -83,10 +80,8 @@ public class WSDLToXMLProcessorTest exte
         if (bo == null) {
             fail("Element <wsdl:operation name=\"sayHi\"> Missed!");
         }
-        it = bo.getBindingInput().getExtensibilityElements().iterator();
         found = false;
-        while (it.hasNext()) {
-            Object obj = it.next();
+        for (Object obj :  bo.getBindingInput().getExtensibilityElements()) {
             if (obj instanceof XMLBindingMessageFormat
                 && ((XMLBindingMessageFormat)obj).getRootNode().getLocalPart().equals("sayHi")) {
                 found = true;
@@ -104,10 +99,8 @@ public class WSDLToXMLProcessorTest exte
         if (service == null) {
             fail("Element wsdl:service Greeter_XMLService Missed!");
         }
-        it = service.getPort("Greeter_XMLPort").getExtensibilityElements().iterator();
         found = false;
-        while (it.hasNext()) {
-            Object obj = it.next();
+        for (Object obj : service.getPort("Greeter_XMLPort").getExtensibilityElements()) {
             if (obj instanceof HTTPAddress) {
                 HTTPAddress xmlHttpAddress = (HTTPAddress)obj;
                 if (xmlHttpAddress.getLocationURI() != null) {