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

[GCI-142] Fix various memory leaks. #3083

Merged
merged 1 commit into from
Dec 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[GCI-142] Check bad code practices through Findbugs or Sonar and fix …
…those issues

null

GCI-142 minor fix

del xtra brace + deepcopy setters

GCI-142 fix travis
  • Loading branch information
ribhavsharma committed Dec 16, 2019
commit 73b051bc9e74094bf4ba811c715ce2dcb2dd4d87
9 changes: 5 additions & 4 deletions api/src/main/java/org/openmrs/CohortMembership.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,15 @@ public void setPatientId(Integer patientId) {
}

public Date getStartDate() {
return startDate;
return startDate != null ? (Date) startDate.clone() : null;
}

public void setStartDate(Date startDate) {
this.startDate = startDate;
this.startDate = startDate != null ? new Date(startDate.getTime()) : null;
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the difference between this and this.startDate = new Date(startDate.getTime()) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hey @f4ww4z. The current code addresses the possibility of null values too.

}

public Date getEndDate() {
return endDate;
return endDate != null ? (Date) endDate.clone() : null;
}

/**
Expand All @@ -112,9 +112,10 @@ public Date getEndDate() {
* @param endDate
*/
public void setEndDate(Date endDate) {
this.endDate = endDate;
this.endDate = endDate != null ? new Date(endDate.getTime()) : null;
ribhavsharma marked this conversation as resolved.
Show resolved Hide resolved
}


/**
* Sorts by following fields, in order:
* <ol>
Expand Down