Skip to content

Commit

Permalink
Properly handle empty values
Browse files Browse the repository at this point in the history
  • Loading branch information
strangelookingnerd committed Nov 19, 2024
1 parent 59716c5 commit d9f8ec7
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void setIcon(String icon) {

@Whitelisted
public String getIcon() {
if (StringUtils.isEmpty(icon)
if (StringUtils.isBlank(icon)
|| icon.startsWith("/")
|| icon.startsWith("symbol-")
|| icon.startsWith("icon-")
Expand Down Expand Up @@ -122,7 +122,7 @@ public void setText(String text) {

@Whitelisted
public String getText() {
if (StringUtils.isEmpty(text)) {
if (StringUtils.isBlank(text)) {
return text;
}

Expand Down Expand Up @@ -161,14 +161,14 @@ public void setLink(String link) {

@Whitelisted
public String getLink() {
if (StringUtils.isEmpty(link)
if (StringUtils.isBlank(link)
|| link.startsWith("/")
|| link.matches("^https?://.*")
|| link.matches("^mailto:.*")) {
return link;
}

LOGGER.log(Level.WARNING, "Invalid link value: '{}' - ignoring it", link);
LOGGER.log(Level.WARNING, () -> "Invalid link value: '" + link + "' - ignoring it");
return null;
}

Expand Down

0 comments on commit d9f8ec7

Please sign in to comment.