Showing posts with label FindBug. Show all posts
Showing posts with label FindBug. Show all posts

Thursday, November 29, 2018

FindBug Malicious code vulnerability Warnings Solutions

FindBug Malicious code vulnerability Warnings
EI_EXPOSE_REP: May expose internal representation by returning reference to mutable object
EI_EXPOSE_REP2: May expose internal representation by incorporating reference to mutable object

public void setCreatedDate(Date createdDate) {
    this.createdDate = createdDate != null ? (Date) createdDate.clone() : null;
}

public Date getCreatedDate() {
    return createdDate != null ? (Date) createdDate.clone() : null;
}