Browse Source

Fix the inefficient use of keySet iterator with entrySet iterator.

The current source code accesses the key and value of a Hashtable entry, using a key that is retrieved from a keySet iterator.
It is more efficient to use an iterator on the entrySet of the Hashtable, to avoid the Map.get(key) lookup.
http://findbugs.sourceforge.net/bugDescriptions.html#WMI_WRONG_MAP_ITERATOR
master
Kui LIU Stefan Bodewig 7 years ago
parent
commit
a4aec92684
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      src/main/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java

+ 3
- 2
src/main/org/apache/tools/ant/taskdefs/optional/ejb/GenericDeploymentTool.java View File

@@ -760,11 +760,12 @@ public class GenericDeploymentTool implements EJBDeploymentTool {
jarStream.setMethod(JarOutputStream.DEFLATED);

// Loop through all the class files found and add them to the jar
for (String entryName : files.keySet()) {
for (Map.Entry<String, File> entryFiles : files.entrySet()) {
String entryName = entryFiles.getKey();
if (entryName.equals(MANIFEST)) {
continue;
}
File entryFile = files.get(entryName);
File entryFile = entryFiles.getValue();
log("adding file '" + entryName + "'", Project.MSG_VERBOSE);
addFileToJar(jarStream, entryFile, entryName);



Loading…
Cancel
Save