You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/10/29 12:23:55 UTC

(commons-compress) branch master updated: Inefficient use of keySet iterator instead of entrySet iterator in pack200.PackingOptions.addOrUpdateAttributeActions(List, Map, int)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git


The following commit(s) were added to refs/heads/master by this push:
     new b514805b Inefficient use of keySet iterator instead of entrySet iterator in pack200.PackingOptions.addOrUpdateAttributeActions(List, Map, int)
b514805b is described below

commit b514805bbde89e7f303d867fe3fb8d6e6a0e2e8b
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Oct 29 08:23:51 2023 -0400

    Inefficient use of keySet iterator instead of entrySet iterator in
    pack200.PackingOptions.addOrUpdateAttributeActions(List, Map, int)
---
 src/changes/changes.xml                                             | 1 +
 .../org/apache/commons/compress/harmony/pack200/PackingOptions.java | 6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index e393827d..af04f9a6 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -73,6 +73,7 @@ The <action> type attribute can be add,update,fix,remove.
       <action type="fix" dev="ggregory" due-to="Gary Gregory">NPE in pack200.NewAttributeBands.Reference.addAttributeToBand(NewAttribute, InputStream).</action>
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Incorrect lazy initialization and update of static field in pack200.CodecEncoding.getSpecifier(Codec, Codec).</action>
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Incorrect string comparison in unpack200.AttributeLayout.numBackwardsCallables().</action>
+      <action type="fix" dev="ggregory" due-to="Gary Gregory">Inefficient use of keySet iterator instead of entrySet iterator in pack200.PackingOptions.addOrUpdateAttributeActions(List, Map, int)</action>
       <!-- UPDATE -->
       <action type="update" dev="ggregory" due-to="Dependabot">Bump org.slf4j:slf4j-api from 2.0.8 to 2.0.9 #413.</action>
       <action type="update" dev="ggregory" due-to="Gary Gregory">Bump commons-io:commons-io from 2.13.0 to 2.15.0.</action>
diff --git a/src/main/java/org/apache/commons/compress/harmony/pack200/PackingOptions.java b/src/main/java/org/apache/commons/compress/harmony/pack200/PackingOptions.java
index 6cfa894e..d4501abe 100644
--- a/src/main/java/org/apache/commons/compress/harmony/pack200/PackingOptions.java
+++ b/src/main/java/org/apache/commons/compress/harmony/pack200/PackingOptions.java
@@ -21,6 +21,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Map.Entry;
 
 import org.objectweb.asm.Attribute;
 
@@ -74,8 +75,9 @@ public class PackingOptions {
     private void addOrUpdateAttributeActions(final List<Attribute> prototypes, final Map<String, String> attributeActions, final int tag) {
         if (attributeActions != null && attributeActions.size() > 0) {
             NewAttribute newAttribute;
-            for (final String name : attributeActions.keySet()) {
-                final String action = attributeActions.get(name);
+            for (final Entry<String, String> entry : attributeActions.entrySet()) {
+                final String name = entry.getKey();
+                final String action = entry.getValue();
                 boolean prototypeExists = false;
                 for (final Object prototype : prototypes) {
                     newAttribute = (NewAttribute) prototype;