turing85 commented on code in PR #17645:
URL: https://github.com/apache/camel/pull/17645#discussion_r2025173442


##########
components/camel-attachments/src/main/java/org/apache/camel/attachment/DefaultAttachmentMessage.java:
##########
@@ -212,7 +212,9 @@ public Set<String> getAttachmentNames() {
 
     @Override
     public void removeAttachment(String id) {
-        getAttachmentsMap().remove(id);
+        Map<String, Object> attachmentsMap = getAttachmentsMap();
+        if (attachmentsMap.remove(id) != null && attachmentsMap.isEmpty())

Review Comment:
   Why check for `attachmentsMap.remove(id) != null`? The check for 
`attachmentsMap.isEmpty()` should suffice and I am not sure how much 
performance we actually safe by the `null`-check.



-- 
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.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to