Hi,
I've got a problem with custom string to date converter using 4.3.30 spring-framework. Converter is not applying when field comes in HTTP request and default object converter has been used instead which leads to datatype mismatch while conversion.
This is description of conversion bean in XML:
```xml
And this is implementation of converter:
```java
public class StringToDateConverter implements Converter<String, Date> {
DateFormatSafeUtils dateFormat = new DateFormatSafeUtils("yyyy-MM-dd HH:mm:ss");
@Override
public Date convert(String source) {
try {
Date date = dateFormat.parse(source);
return date;
} catch (ParseException e) {
throw new IllegalArgumentException("Invalid date value '" + source + "'");
}
}
}
When an HTTP request comes with data in string, Spring tries to apply datetimeformat with string to date formatter instead of my StringToDateConverter
.
The weirdest thing is that converter worked fine with 4.1.6.RELEASE of spring-framework.
Best regards, Dash
Comment From: alqa-dash
UPD: Just found that converter works with 4.2.2 and doesn't with 4.2.3. How can it be?
Comment From: sbrannen
I've got a problem with custom string to date converter using 4.3.30 spring-framework.
Please note that the 4.3.x branch is no longer maintained.
Have you tried using the latest 5.2.x or 5.3.x releases?
Comment From: alqa-dash
Unfortunately this is pretty long-life project with dependencies which are not supported or exist in case of 5.x spring.
Comment From: snicoll
Unfortunately, 4.x is EOL so we'd need you to give that a try with a supported version of the framework before investigating. If you can reproduce, please attach a small sample that we can use to reproduce the problem.
Comment From: spring-projects-issues
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.