Fix null Tag.userSelected error by defaulting to false if the value is null. (#4605)

This commit is contained in:
Luke deGruchy 2023-02-27 19:19:09 -05:00 committed by GitHub
parent fe288fb29a
commit 795baa196b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -0,0 +1,5 @@
---
type: fix
issue: 4604
jira: SMILE-4688
title: "Doing a GET for a resource tag created before 4204 will return a null error on userSelected. This has been fixed by defaulting null to false."

View File

@ -86,7 +86,7 @@ public class TagDefinition implements Serializable {
private String myVersion;
@Column(name = "TAG_USER_SELECTED")
private boolean myUserSelected;
private Boolean myUserSelected;
@Transient
private transient Integer myHashCode;
@ -162,7 +162,11 @@ public class TagDefinition implements Serializable {
}
}
public Boolean getUserSelected() { return myUserSelected; }
public Boolean getUserSelected() {
// TODO: LD: this is not ideal as we are implicitly assuming null is false.
// Ideally we should fix IBaseCoding to return wrapper Boolean but that will involve another core/hapi release
return myUserSelected != null ? myUserSelected : false;
}
public void setUserSelected(Boolean theUserSelected) {
myUserSelected = theUserSelected != null && theUserSelected;