Skip to content

Commit

Permalink
CCMSPUI-468 | Fix null checks
Browse files Browse the repository at this point in the history
  • Loading branch information
arunkumar461 committed Jan 5, 2025
1 parent a408ef3 commit eaa33d6
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package uk.gov.laa.ccms.springboot.dialect;

import static org.springframework.util.StringUtils.hasText;

import java.util.Map;
import org.thymeleaf.context.ITemplateContext;
import org.thymeleaf.model.IModel;
Expand Down Expand Up @@ -48,10 +50,10 @@ private String buildDatePickerHtml(DatePickerAttributes datePickerAttributes) {
StringBuilder html = new StringBuilder();
html.append("<div class=\"moj-datepicker\" data-module=\"moj-date-picker\"");

if (!datePickerAttributes.minDate().isEmpty()) {
if (hasText(datePickerAttributes.minDate())) {
html.append(" data-min-date=\"").append(datePickerAttributes.minDate()).append("\"");
}
if (!datePickerAttributes.maxDate().isEmpty()) {
if (hasText(datePickerAttributes.maxDate())) {
html.append(" data-max-date=\"").append(datePickerAttributes.maxDate()).append("\"");
}

Expand Down Expand Up @@ -95,7 +97,7 @@ private String buildDatePickerHtml(DatePickerAttributes datePickerAttributes) {
html.append(" ").append(datePickerAttributes.id()).append("-error");
}

if (!datePickerAttributes.value().isEmpty()) {
if (hasText(datePickerAttributes.value())) {
html.append("\" value=\"").append(datePickerAttributes.value());
}

Expand Down

0 comments on commit eaa33d6

Please sign in to comment.