butek 02/04/09 08:41:30
Modified: java/src/org/apache/axis/client Service.java
java/src/org/apache/axis/deployment/wsdd
WSDDDeployableItem.java
java/src/org/apache/axis/encoding/ser MapSerializer.java
SimpleDeserializer.java
java/src/org/apache/axis/handlers SimpleSessionHandler.java
java/src/org/apache/axis/wsdl/fromJava Namespaces.java
java/src/org/apache/axis/wsdl/toJava
JavaBeanHelperWriter.java JavaDefinitionWriter.java
Namespaces.java SymTabEntry.java
Log:
Some suggestions by Richard Emberson ([EMAIL PROTECTED]). Better
usage (more efficient/more appropriate) of Map and Map iterators.
Revision Changes Path
1.48 +2 -13 xml-axis/java/src/org/apache/axis/client/Service.java
Index: Service.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/Service.java,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- Service.java 27 Mar 2002 17:53:06 -0000 1.47
+++ Service.java 9 Apr 2002 15:41:29 -0000 1.48
@@ -514,22 +514,11 @@
*/
public Iterator getPorts() {
if ( wsdlService == null ) return( null );
- Map map = wsdlService.getPorts();
+ Map map = wsdlService.getPorts();
if ( map == null ) return( null );
- Set set = map.keySet();
- Iterator iter = set.iterator();
- Set ports = null ;
-
- while ( iter.hasNext() ) {
- String name = (String) iter.next();
- Port port = (Port) map.get( name );
- if ( ports == null ) ports = new HashSet();
- ports.add( port );
- }
- if ( ports == null ) return( null );
- return( ports.iterator() );
+ return map.values().iterator();
}
/**
1.27 +7 -5
xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDDeployableItem.java
Index: WSDDDeployableItem.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDDeployableItem.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- WSDDDeployableItem.java 8 Mar 2002 19:51:07 -0000 1.26
+++ WSDDDeployableItem.java 9 Apr 2002 15:41:29 -0000 1.27
@@ -71,6 +71,7 @@
import javax.xml.rpc.namespace.QName;
import java.util.Hashtable;
import java.util.Iterator;
+import java.util.Map;
import java.util.Set;
import java.io.IOException;
@@ -251,16 +252,17 @@
{
if (parameters == null)
return;
-
- Set keys = parameters.keySet();
- Iterator i = keys.iterator();
+
+ Set entries = parameters.entrySet();
+ Iterator i = entries.iterator();
while (i.hasNext()) {
- String name = (String)i.next();
+ Map.Entry entry = (Map.Entry) i.next();
+ String name = (String) entry.getKey();
AttributesImpl attrs = new AttributesImpl();
attrs.addAttribute("", "name", "name", "CDATA", name);
attrs.addAttribute("", "value", "value", "CDATA",
- parameters.get(name).toString());
+ entry.getValue().toString());
if (parameters.isKeyLocked(name)) {
attrs.addAttribute("", "locked", "locked", "CDATA", "true");
}
1.6 +4 -3
xml-axis/java/src/org/apache/axis/encoding/ser/MapSerializer.java
Index: MapSerializer.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/MapSerializer.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- MapSerializer.java 22 Feb 2002 23:39:44 -0000 1.5
+++ MapSerializer.java 9 Apr 2002 15:41:29 -0000 1.6
@@ -125,10 +125,11 @@
context.startElement(name, attributes);
- for (Iterator i = map.keySet().iterator(); i.hasNext(); )
+ for (Iterator i = map.entrySet().iterator(); i.hasNext(); )
{
- Object key = i.next();
- Object val = map.get(key);
+ Map.Entry entry = (Map.Entry) i.next();
+ Object key = entry.getKey();
+ Object val = entry.getValue();
context.startElement(QNAME_ITEM, null);
1.10 +6 -4
xml-axis/java/src/org/apache/axis/encoding/ser/SimpleDeserializer.java
Index: SimpleDeserializer.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/ser/SimpleDeserializer.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- SimpleDeserializer.java 8 Apr 2002 15:43:14 -0000 1.9
+++ SimpleDeserializer.java 9 Apr 2002 15:41:29 -0000 1.10
@@ -62,6 +62,7 @@
import java.lang.reflect.Method;
import java.util.Vector;
import java.util.HashMap;
+import java.util.Map;
import java.util.Set;
import java.util.Iterator;
@@ -339,10 +340,11 @@
return;
// loop through map
- Set keys = attributeMap.keySet();
- for (Iterator iterator = keys.iterator(); iterator.hasNext();) {
- String name = (String) iterator.next();
- Object val = attributeMap.get(name);
+ Set entries = attributeMap.entrySet();
+ for (Iterator iterator = entries.iterator(); iterator.hasNext();) {
+ Map.Entry entry = (Map.Entry) iterator.next();
+ String name = (String) entry.getKey();
+ Object val = entry.getValue();
BeanPropertyDescriptor bpd =
(BeanPropertyDescriptor) propertyMap.get(name);
1.17 +6 -4
xml-axis/java/src/org/apache/axis/handlers/SimpleSessionHandler.java
Index: SimpleSessionHandler.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/handlers/SimpleSessionHandler.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- SimpleSessionHandler.java 28 Mar 2002 03:15:18 -0000 1.16
+++ SimpleSessionHandler.java 9 Apr 2002 15:41:30 -0000 1.17
@@ -71,6 +71,7 @@
import javax.xml.rpc.namespace.QName;
import java.util.Hashtable;
import java.util.Iterator;
+import java.util.Map;
import java.util.Set;
import java.util.HashSet;
@@ -151,13 +152,14 @@
}
if (reap) {
- Set keys = activeSessions.keySet();
+ Set entries = activeSessions.entrySet();
Set victims = new HashSet();
Object key;
Iterator i;
- for (i = keys.iterator(); i.hasNext();) {
- key = i.next();
- SimpleSession session = (SimpleSession)activeSessions.get(key);
+ for (i = entries.iterator(); i.hasNext();) {
+ Map.Entry entry = (Map.Entry) i.next();
+ key = entry.getKey();
+ SimpleSession session = (SimpleSession) entry.getValue();
if ((curTime - session.getLastAccessTime()) >
(session.getTimeout() * 1000)) {
log.debug(JavaUtils.getMessage("timeout00",
1.3 +6 -8 xml-axis/java/src/org/apache/axis/wsdl/fromJava/Namespaces.java
Index: Namespaces.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/fromJava/Namespaces.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Namespaces.java 26 Mar 2002 16:09:45 -0000 1.2
+++ Namespaces.java 9 Apr 2002 15:41:30 -0000 1.3
@@ -128,11 +128,10 @@
* @param map packageName/namespace map
*/
public void putAll(Map map) {
- Iterator i = map.keySet().iterator();
+ Iterator i = map.entrySet().iterator();
while (i.hasNext()) {
- Object key = i.next();
- String namespace = (String) map.get(key);
- put(key, namespace, null);
+ Map.Entry entry = (Map.Entry) i.next();
+ put(entry.getKey(), entry.getValue(), null);
}
}
@@ -164,11 +163,10 @@
* @param map packageName/namespace map
*/
public void putAllPrefix(Map map) {
- Iterator i = namespacePrefixMap.keySet().iterator();
+ Iterator i = map.entrySet().iterator();
while (i.hasNext()) {
- Object key = i.next();
- String prefix = (String) map.get(key);
- put(key, prefix);
+ Map.Entry entry = (Map.Entry) i.next();
+ put(entry.getKey(), entry.getValue());
}
}
1.6 +5 -3
xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaBeanHelperWriter.java
Index: JavaBeanHelperWriter.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaBeanHelperWriter.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- JavaBeanHelperWriter.java 3 Apr 2002 06:09:55 -0000 1.5
+++ JavaBeanHelperWriter.java 9 Apr 2002 15:41:30 -0000 1.6
@@ -62,6 +62,7 @@
import java.util.Vector;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.Map;
/**
* This is Wsdl2java's Helper Type Writer. It writes the <typeName>.java file.
@@ -182,10 +183,11 @@
}
if (elementMappings != null) {
- Iterator i = elementMappings.keySet().iterator();
+ Iterator i = elementMappings.entrySet().iterator();
while (i.hasNext()) {
- String fieldName = (String)i.next();
- QName xmlName = (QName)elementMappings.get(fieldName);
+ Map.Entry entry = (Map.Entry) i.next();
+ String fieldName = (String)entry.getKey();
+ QName xmlName = (QName) entry.getValue();
pw.print(" ");
if (!wroteFieldType) {
pw.print("org.apache.axis.description.FieldDesc ");
1.5 +7 -6
xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaDefinitionWriter.java
Index: JavaDefinitionWriter.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/JavaDefinitionWriter.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- JavaDefinitionWriter.java 29 Mar 2002 22:13:05 -0000 1.4
+++ JavaDefinitionWriter.java 9 Apr 2002 15:41:30 -0000 1.5
@@ -115,10 +115,11 @@
collectFaults(definition, faults);
// iterate over fault list, emitting code.
- Iterator fi = faults.keySet().iterator();
+ Iterator fi = faults.entrySet().iterator();
while (fi.hasNext()) {
- Fault fault = (Fault) fi.next();
- QName faultQName = (QName) faults.get(fault);
+ Map.Entry entry = (Map.Entry) fi.next();
+ Fault fault = (Fault) entry.getKey();
+ QName faultQName = (QName) entry.getValue();
new JavaFaultWriter(emitter, faultQName, fault, symbolTable).write();
}
} // writeFaults
@@ -130,9 +131,9 @@
private void collectFaults(Definition def, Map faults) throws IOException {
Vector faultList = new Vector();
Map imports = def.getImports();
- Object[] importKeys = imports.keySet().toArray();
- for (int i = 0; i < importKeys.length; ++i) {
- Vector v = (Vector) imports.get(importKeys[i]);
+ Object[] importValues = imports.values().toArray();
+ for (int i = 0; i < importValues.length; ++i) {
+ Vector v = (Vector) importValues[i];
for (int j = 0; j < v.size(); ++j) {
Import imp = (Import) v.get(j);
if (!importedFiles.contains(imp.getLocationURI())) {
1.4 +4 -3 xml-axis/java/src/org/apache/axis/wsdl/toJava/Namespaces.java
Index: Namespaces.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/Namespaces.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Namespaces.java 28 Feb 2002 21:33:05 -0000 1.3
+++ Namespaces.java 9 Apr 2002 15:41:30 -0000 1.4
@@ -161,10 +161,11 @@
* also makes sure the value strings are javified.
*/
public void putAll(Map map) {
- Iterator i = map.keySet().iterator();
+ Iterator i = map.entrySet().iterator();
while (i.hasNext()) {
- Object key = i.next();
- String pkg = (String) map.get(key);
+ Map.Entry entry = (Map.Entry) i.next();
+ Object key = entry.getKey();
+ String pkg = (String) entry.getValue();
pkg = javify(pkg);
put(key, pkg);
}
1.6 +6 -4 xml-axis/java/src/org/apache/axis/wsdl/toJava/SymTabEntry.java
Index: SymTabEntry.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/toJava/SymTabEntry.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- SymTabEntry.java 15 Feb 2002 19:41:17 -0000 1.5
+++ SymTabEntry.java 9 Apr 2002 15:41:30 -0000 1.6
@@ -57,6 +57,7 @@
import java.util.HashMap;
import java.util.Iterator;
+import java.util.Map;
import javax.wsdl.QName;
@@ -156,10 +157,11 @@
indent + "name: " + name + '\n' +
indent + "isReferenced? " + isReferenced + '\n';
String prefix = indent + "dynamicVars: ";
- Iterator keys = dynamicVars.keySet().iterator();
- while (keys.hasNext()) {
- Object key = keys.next();
- string += prefix + key + " = " + dynamicVars.get(key) + '\n';
+ Iterator entries = dynamicVars.entrySet().iterator();
+ while (entries.hasNext()) {
+ Map.Entry entry = (Map.Entry) entries.next();
+ Object key = entry.getKey();
+ string += prefix + key + " = " + entry.getValue() + '\n';
prefix = indent + " ";
}
return string;