anirudh-04 commented on code in PR #17645:
URL: https://github.com/apache/camel/pull/17645#discussion_r2025208029


##########
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:
   Understood, I had added the check to ensure an actual removal occurred. If 
it makes the code less readable I can simplify the logic.



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