-
Notifications
You must be signed in to change notification settings - Fork 266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] destinationSet.removeAllExcept doesn't remove destinations if no match is found #5875
Comments
On 4.3, it does not appear to work that way. In the source transformer: destinationSet.removeAllExcept(['ad']); Send a message in and all three destinations are in fact removed. The three destinations are named
|
I suspect you are doing the below, i.e. you are not passing an array. destinationSet.removeAllExcept('ad'); |
Indeed I am (I copied what my predecessor had done). Does 4.3 remove all three destinations if you pass a string instead of an array? Passing a string seems to remove all but the desired channels in my tests IF there is a match. |
Blaming the last person, lol. The call needs an array, not a string so 4.3 does the same thing. I suppose you might change/update your issue to:
|
I'll just log a new issue for that. Thanks! |
This is not true. There are two versions of DestinationSet.removeAllExcept. One takes an |
I'm able to confirm the bug. It only occurs when you are using a destination name which doesn't exist. If you pass it a number for a metadata id which doesn't exist, then it will correctly remove all destinations. |
The problem is in this method: connect/server/src/com/mirth/connect/server/userutil/DestinationSet.java Lines 100 to 110 in 010f2a4
Lines 104-106 should be changed to something like: final Set<Integer> set = (metaDataId != null) ? Collections.singleton(metaDataId) : Collections.emptySet();
return metaDataIds.retainAll(set); |
Describe the bug
When using
destinationSet.removeAllExcept(<destination name>)
all destinations are enabled if no destinations match the supplied parameter.This can lead to over-transmission of messages if there is a typo or some other issue in the
destinationSet.removeAllExcept(<destination name>)
, leading to unintended PHI disclosures.To Reproduce
Setup steps (if required). Example:
Steps to reproduce the behavior:
destinationSet.removeAllExcept(<destination name>)
with a typo in the<destination name>
valueExpected behavior
All destinations would be removed except the supplied destination. If no match is found all destinations should be removed (remove all except the one that wasn't found).
Actual behavior
When using
destinationSet.removeAllExcept(<destination>)
all destinations are enabled if no destinations match the supplied parameter.Environment (please complete the following information):
Workaround(s)
Catch the output of destinationSet.removeAllExcept and perform a destinationSet.removeAll() if no destinations were removed.
The text was updated successfully, but these errors were encountered: