I am trying to validate user entered date in a composite entity. It works fine to through message but when i try to restore the previous date then getting exception. Here is the code that i have used in controller.
@Override
public void init(Map<String, Object> params) {
bankTranDetailDs.addItemPropertyChangeListener(e -> {
if ("tranDate".equals(e.getProperty())) {
if (e.getItem().getTranDate().before(dateFrom) || e.getItem().getTranDate().after(dateTo) ) {
e.getItem().setTranDate((Date) e.getPrevValue());
showNotification("Sorry, invalid date entered for the selected financial period", NotificationType.HUMANIZED);
}
Error
java.lang.StackOverflowError
at ch.qos.logback.classic.Logger.trace(Logger.java:458)
at com.haulmont.cuba.gui.data.impl.AbstractDatasource$ItemListener.propertyChanged(AbstractDatasource.java:321)
at com.haulmont.chile.core.model.impl.AbstractInstance.propertyChanged(AbstractInstance.java:47)
at com.company.entity.BankTranDetail.setTranDate(BankTranDetail.java:93)