jbertram commented on a change in pull request #2553: NO-JIRA Fix a
"Inefficient Map Iterator" SpotBugs warning
URL: https://github.com/apache/activemq-artemis/pull/2553#discussion_r281338956
##########
File path:
artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AbstractControl.java
##########
@@ -106,8 +106,8 @@ protected String sendMessage(SimpleString address,
try {
CoreMessage message = new CoreMessage(storageManager.generateID(),
50);
if (headers != null) {
- for (String header : headers.keySet()) {
- message.putStringProperty(new SimpleString(header), new
SimpleString(headers.get(header)));
+ for (Map.Entry<String, String> header : headers.entrySet()) {
+ message.putStringProperty(new SimpleString(header.getKey()),
new SimpleString(headers.get(header.getValue())));
Review comment:
The point of the SpotBugs warning is to avoid calling `Map.get(key)`.
However, this fix doesn't actually do that and even introduced [a
bug](https://issues.apache.org/jira/browse/ARTEMIS-2332).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services