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


##########
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:
   >  I tend on the side of clarity, and having attachmentsMap.remove(id) 
separated from the condition seems clearer to me
   
   I agree. Please also add braces (`{` `}`) to the if statement.



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