-
Notifications
You must be signed in to change notification settings - Fork 0
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
#4414 implement Set #2
base: development
Are you sure you want to change the base?
Conversation
|
||
private Map<String, Integer> destinationIdMap; | ||
private Map<String, Integer> destinationIdMap = Collections.emptyMap(); | ||
private Set<Integer> metaDataIds; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this also default to Collections.emptySet() ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, as we use its add() which emptySet() doesn't implement
@@ -43,6 +47,7 @@ public DestinationSet(ImmutableConnectorMessage connectorMessage) { | |||
this.metaDataIds = (Set<Integer>) connectorMessage.getSourceMap().get(Constants.DESTINATION_SET_KEY); | |||
} | |||
} catch (Exception e) { | |||
metaDataIds = new HashSet<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the catch block even necessary here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the rare case of a ClassCastException when pulling out the SourceMap. Until they fix that, it's worth leaving.
server/src/com/mirth/connect/server/userutil/DestinationSet.java
Outdated
Show resolved
Hide resolved
assertEquals(4, ds.size()); | ||
assertTrue(ds.addAll(Arrays.asList(5, 6))); | ||
assertEquals(6, ds.size()); | ||
//TODO is this what we want? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think so. The behavior of DestiationSet is such that if any operation fails, it returns false
assertFalse(ds.containsAll(Arrays.asList("Invalid"))); | ||
assertFalse(ds.containsAll(Collections.singleton(null))); | ||
//TODO is this what we want? | ||
assertFalse(ds.containsAll(null)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes this is what you want
I have TODOs in the tests which welcome feedback involving what should happen when nulls are passed to various functions.