Commit 4878c009 authored by Raimbek Egemberdiev's avatar Raimbek Egemberdiev

компонент DateCmp исправлена ошибка NullPointerException

parent 9bdab9d6
...@@ -23,10 +23,17 @@ public class DateConverter extends AbstractComponentConverter { ...@@ -23,10 +23,17 @@ public class DateConverter extends AbstractComponentConverter {
if (field.getType().isAssignableFrom(Date.class)) { if (field.getType().isAssignableFrom(Date.class)) {
Date date = (Date) field.get(asForm); Date date = (Date) field.get(asForm);
if (date == null) {
return asFormData;
}
String dateFormat = getDateFormat(annotation); String dateFormat = getDateFormat(annotation);
try {
String dateValue = new SimpleDateFormat(dateFormat).format(date); String dateValue = new SimpleDateFormat(dateFormat).format(date);
asFormData.setValue(dateValue); asFormData.setValue(dateValue);
asFormData.setKey(dateValue); asFormData.setKey(dateValue);
} catch (Exception ex) {
return asFormData;
}
} else { } else {
asFormData.setKey(String.valueOf(field.get(asForm))); asFormData.setKey(String.valueOf(field.get(asForm)));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment