Skip to content

Commit

Permalink
[SYNCOPE-1851] - Resolved NullPointerException related to the DateFie…
Browse files Browse the repository at this point in the history
…ld in the SyncopeFormPanel class (#949)
  • Loading branch information
TatoniMatteo authored Jan 3, 2025
1 parent 4c3a8c7 commit 9331405
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ public void setObject(final Boolean object) {
break;

case Date:
FastDateFormat formatter = FastDateFormat.getInstance(prop.getDatePattern());
FastDateFormat formatter = StringUtils.isBlank(prop.getDatePattern())
? FastDateFormat.getInstance()
: FastDateFormat.getInstance(prop.getDatePattern());
field = new AjaxDateTimeFieldPanel("value", label, new PropertyModel<>(prop, "value") {

private static final long serialVersionUID = -3743432456095828573L;
Expand All @@ -111,7 +113,7 @@ public Date getObject() {

@Override
public void setObject(final Date object) {
prop.setValue(formatter.format(object));
Optional.ofNullable(object).ifPresent(date -> prop.setValue(formatter.format(date)));
}
}, formatter);
break;
Expand Down

0 comments on commit 9331405

Please sign in to comment.