This is an automated email from the ASF dual-hosted git repository.
ilgrosso pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/syncope.git
The following commit(s) were added to refs/heads/master by this push:
new 2d35a9905c [SYNCOPE-1851] - Resolved NullPointerException related to
the DateField in the SyncopeFormPanel class (#949)
2d35a9905c is described below
commit 2d35a9905cad547606f973d725572d56a3bef0df
Author: Matteo Tatoni <[email protected]>
AuthorDate: Fri Jan 3 10:47:07 2025 +0100
[SYNCOPE-1851] - Resolved NullPointerException related to the DateField in
the SyncopeFormPanel class (#949)
---
.../apache/syncope/client/ui/commons/panels/SyncopeFormPanel.java | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git
a/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/panels/SyncopeFormPanel.java
b/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/panels/SyncopeFormPanel.java
index 8746c4b75a..2ab1ea062a 100644
---
a/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/panels/SyncopeFormPanel.java
+++
b/client/idrepo/common-ui/src/main/java/org/apache/syncope/client/ui/commons/panels/SyncopeFormPanel.java
@@ -92,7 +92,9 @@ public class SyncopeFormPanel<F extends SyncopeForm> extends
Panel {
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;
@@ -111,7 +113,7 @@ public class SyncopeFormPanel<F extends SyncopeForm>
extends Panel {
@Override
public void setObject(final Date object) {
- prop.setValue(formatter.format(object));
+ Optional.ofNullable(object).ifPresent(date ->
prop.setValue(formatter.format(date)));
}
}, formatter);
break;