turing85 commented on code in PR #17645:
URL: https://github.com/apache/camel/pull/17645#discussion_r2025258669
##########
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:
From my point of view, this are two different requirements (removing the
requested attachment, and checking whether the attachments are empty). I tend
on the side of clarity, and having `attachmentsMap.remove(id)` separated from
the condition seems clearer to me. But I am not a maintainer; let's see what
@davsclaus and/or @jamesnetherton say.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]