From a673bc9cfe8c8697e0c1801c37c4228d66932eda Mon Sep 17 00:00:00 2001 From: heshan Date: Sat, 5 Jun 2010 04:44:08 +0000 Subject: [PATCH] Refactored code. git-svn-id: http://svn.wso2.org/repos/wso2/trunk/wsf@67630 a5903396-d722-0410-b921-86c7d4935375 --- .../org/wso2/wsf/jython/client/WSClient.java | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/jython/client/core/src/main/java/org/wso2/wsf/jython/client/WSClient.java b/jython/client/core/src/main/java/org/wso2/wsf/jython/client/WSClient.java index af8460462..5b0f86046 100644 --- a/jython/client/core/src/main/java/org/wso2/wsf/jython/client/WSClient.java +++ b/jython/client/core/src/main/java/org/wso2/wsf/jython/client/WSClient.java @@ -41,7 +41,6 @@ import java.io.ByteArrayInputStream; import java.io.InputStream; import java.util.HashMap; -import java.util.Iterator; public class WSClient { private ServiceClient client = null; @@ -88,9 +87,8 @@ public WSClient(PyDictionary pyDict, String pyFile) throws WSFault { options = new Options(); - Iterator it = map.keySet().iterator(); - while (it.hasNext()) { - String key = (String) it.next(); + for (Object o : map.keySet()) { + String key = (String) o; //System.out.println("\nKey2 " + key + " === Value " +/*(String)*/ map.get(key)); if ("to".equalsIgnoreCase(key)) { // Setting End Point Reference options.setTo(new EndpointReference((String) map.get(key))); @@ -179,8 +177,8 @@ public OMElement request(Object opt) throws WSFault { String strTemp[]; map = new HashMap(); - for (int i = 0; i < str.length; i++) { - strTemp = str[i].split(":"); + for (String aStr : str) { + strTemp = aStr.split(":"); map.put(strTemp[0].trim(), strTemp[1].trim()); } @@ -214,11 +212,9 @@ public OMElement request(Object opt) throws WSFault { // if attachments are available , add them to the OMElement if (hasAttachments) { - Iterator k2 = map.keySet().iterator(); - while (k2.hasNext()) { - String key2 = k2.next(); + for (String key : map.keySet()) { //System.out.println("key" + key2 + "||" + map.get(key2)); - FileDataSource fileDataSource = new FileDataSource(map.get(key2)); + FileDataSource fileDataSource = new FileDataSource(map.get(key)); DataHandler expectedDataHandler = new DataHandler(fileDataSource); OMFactory factory = OMAbstractFactory.getOMFactory(); OMTextImpl expectedTextData = new OMTextImpl(expectedDataHandler, true, factory);