Skip to content
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

Refactor : Removed some Implementation smells #147

Merged
merged 3 commits into from
May 13, 2024

Conversation

Patel-Savan
Copy link
Contributor

No description provided.

Copy link
Member

@joshua-roberts joshua-roberts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good except for the small logic fix. Can you rebase on master? Thanks!

@@ -429,8 +431,10 @@ static void checkAccessRightsValid(Graph graph, AccessRightSet accessRightSet) t

@Override
public void dissociate(String ua, String target) throws PMException {
if ((!nodeExists(ua) || !nodeExists(target))
|| (!getAssociationsWithSource(ua).contains(new Association(ua, target)))) {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good but the logic is slightly different. We don't want to call getAssociationsWithSource if the ua node does not exist. The previous logic relied on the if statement short circuiting if the node did not exist so getAssociationsWithSource was never called. You could change it to something like this:

boolean nodesNotExist = (!nodeExists(ua) || !nodeExists(target));
if (nodesNotExist) {
    return;
}

boolean pathNotExist = (!getAssociationsWithSource(ua).contains(new Association(ua, target)));
if (pathNotExist) {
    return;
}

to get the same logic as the short circuit.

@joshua-roberts joshua-roberts merged commit 29184cf into usnistgov:master May 13, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants